Skip to content

Commit

Permalink
datapath-windows: Update VXLAN header information
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alin Serdean authored and blp committed Jul 15, 2015
1 parent a901af0 commit 4ec96f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
13 changes: 8 additions & 5 deletions datapath-windows/ovsext/Vxlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

#include "precomp.h"
#include "Atomic.h"
#include "NetProto.h"
#include "Switch.h"
#include "Vport.h"
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
1 change: 1 addition & 0 deletions datapath-windows/ovsext/Vxlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ typedef struct _OVS_VXLAN_VPORT {
UINT64 slowInPkts;
UINT64 slowOutPkts;
UINT64 filterID;
UINT64 ipId;
/*
* To be filled
*/
Expand Down

0 comments on commit 4ec96f5

Please sign in to comment.