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>
#include "NetProto.h"
#include "Switch.h"
#include "Vport.h"
#include "NetProto.h"
#include "Switch.h"
#include "Vport.h"
ipHdr = (IPHdr *)((PCHAR)ethHdr + sizeof *ethHdr);
ipHdr->ihl = sizeof *ipHdr / 4;
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->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);
ipHdr->ttl = tunKey->ttl ? tunKey->ttl : VXLAN_DEFAULT_TTL;
ipHdr->protocol = IPPROTO_UDP;
ASSERT(tunKey->dst == fwdInfo->dstIpAddr);
/* UDP header */
udpHdr = (UDPHdr *)((PCHAR)ipHdr + sizeof *ipHdr);
/* 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);
udpHdr->dest = htons(vportVxlan->dstPort);
udpHdr->len = htons(NET_BUFFER_DATA_LENGTH(curNb) - headRoom +
sizeof *udpHdr + sizeof *vxlanHdr);
UINT64 slowInPkts;
UINT64 slowOutPkts;
UINT64 filterID;
UINT64 slowInPkts;
UINT64 slowOutPkts;
UINT64 filterID;