summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/Vxlan.c
diff options
context:
space:
mode:
authorAlin Serdean <aserdean@cloudbasesolutions.com>2015-07-13 16:59:26 +0000
committerBen Pfaff <blp@nicira.com>2015-07-15 10:41:46 -0700
commit55d398e9791e79b8d8d7aab0c4eaca731199d838 (patch)
treecc9e032f32502d62b29c5f03b8b26acc74365122 /datapath-windows/ovsext/Vxlan.c
parentf18390b7fc36f160e163e4b24516e42598426cfb (diff)
downloadopenvswitch-55d398e9791e79b8d8d7aab0c4eaca731199d838.tar.gz
datapath-windows: Update VXLAN header information
Use tunnel key information on the IP header preceding the VXLAN header. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Eitan Eliahu <eliahue@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'datapath-windows/ovsext/Vxlan.c')
-rw-r--r--datapath-windows/ovsext/Vxlan.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/datapath-windows/ovsext/Vxlan.c b/datapath-windows/ovsext/Vxlan.c
index b84c1d0b4..f700b76f8 100644
--- a/datapath-windows/ovsext/Vxlan.c
+++ b/datapath-windows/ovsext/Vxlan.c
@@ -15,6 +15,7 @@
*/
#include "precomp.h"
+#include "Atomic.h"
#include "NetProto.h"
#include "Switch.h"
#include "Vport.h"
@@ -263,11 +264,13 @@ OvsDoEncapVxlan(POVS_VPORT_ENTRY vport,
ipHdr = (IPHdr *)((PCHAR)ethHdr + sizeof *ethHdr);
ipHdr->ihl = sizeof *ipHdr / 4;
- ipHdr->version = IPV4;
- ipHdr->tos = 0;
+ ipHdr->version = IPPROTO_IPV4;
+ ipHdr->tos = tunKey->tos;
ipHdr->tot_len = htons(NET_BUFFER_DATA_LENGTH(curNb) - sizeof *ethHdr);
- ipHdr->id = 0;
- ipHdr->frag_off = IP_DF_NBO;
+ ipHdr->id = (uint16)atomic_add64(&vportVxlan->ipId,
+ NET_BUFFER_DATA_LENGTH(curNb));
+ ipHdr->frag_off = (tunKey->flags & OVS_TNL_F_DONT_FRAGMENT) ?
+ IP_DF_NBO : 0;
ipHdr->ttl = tunKey->ttl ? tunKey->ttl : VXLAN_DEFAULT_TTL;
ipHdr->protocol = IPPROTO_UDP;
ASSERT(tunKey->dst == fwdInfo->dstIpAddr);
@@ -279,7 +282,7 @@ OvsDoEncapVxlan(POVS_VPORT_ENTRY vport,
/* UDP header */
udpHdr = (UDPHdr *)((PCHAR)ipHdr + sizeof *ipHdr);
- udpHdr->source = htons(tunKey->flow_hash | 32768);
+ udpHdr->source = htons(tunKey->flow_hash | MAXINT16);
udpHdr->dest = htons(vportVxlan->dstPort);
udpHdr->len = htons(NET_BUFFER_DATA_LENGTH(curNb) - headRoom +
sizeof *udpHdr + sizeof *vxlanHdr);