All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 4ec96f5c authored by Alin Serdean's avatar Alin Serdean Committed by Ben Pfaff

datapath-windows: Update VXLAN header information

Use tunnel key information on the IP header preceding the VXLAN header.
Signed-off-by: default avatarAlin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: default avatarEitan Eliahu <eliahue@vmware.com>
Signed-off-by: default avatarBen Pfaff <blp@nicira.com>
parent a901af0b
......@@ -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);
......
......@@ -25,6 +25,7 @@ typedef struct _OVS_VXLAN_VPORT {
UINT64 slowInPkts;
UINT64 slowOutPkts;
UINT64 filterID;
UINT64 ipId;
/*
* To be filled
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment