summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/Vxlan.c
diff options
context:
space:
mode:
authorNithin Raju <nithin@vmware.com>2015-06-19 09:13:08 -0700
committerGurucharan Shetty <gshetty@nicira.com>2015-06-19 12:57:07 -0700
commit0b623ad5a8b8ab2a8b7441bd43579eb52bdc672f (patch)
tree950f38776008ce149abb91fd9d22fa331d32e9ae /datapath-windows/ovsext/Vxlan.c
parent2d34dbd9e1706b71bad630a9c8d8851dd511ce24 (diff)
downloadopenvswitch-0b623ad5a8b8ab2a8b7441bd43579eb52bdc672f.tar.gz
datapath-windows: use correct dst port during Vxlan Tx
A previous commit used the wrong DST port in the UDP header during Vxlan Tx which caused Vxlan tunneling to break. Fixing it here.. Also included is a cosmetic fix in OvsDetectTunnelRxPkt() where we were using htons() instead of ntohs(). Doesn't make a difference in practice though. One more change is, OvsIpHlprCbVxlan() has been nuked since it is not used. Not sure if it is worth being resurrected. Testing done: Ping across Vxlan tunnel and Stt tunnel. Signed-off-by: Nithin Raju <nithin@vmware.com> Reported-by: Eitan Eliahu <eliahue@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Diffstat (limited to 'datapath-windows/ovsext/Vxlan.c')
-rw-r--r--datapath-windows/ovsext/Vxlan.c53
1 files changed, 11 insertions, 42 deletions
diff --git a/datapath-windows/ovsext/Vxlan.c b/datapath-windows/ovsext/Vxlan.c
index fa6be666b..f43805aa3 100644
--- a/datapath-windows/ovsext/Vxlan.c
+++ b/datapath-windows/ovsext/Vxlan.c
@@ -170,7 +170,8 @@ OvsCleanupVxlanTunnel(PIRP irp,
*----------------------------------------------------------------------------
*/
static __inline NDIS_STATUS
-OvsDoEncapVxlan(PNET_BUFFER_LIST curNbl,
+OvsDoEncapVxlan(POVS_VPORT_ENTRY vport,
+ PNET_BUFFER_LIST curNbl,
OvsIPv4TunnelKey *tunKey,
POVS_FWD_INFO fwdInfo,
POVS_PACKET_HDR_INFO layers,
@@ -185,6 +186,7 @@ OvsDoEncapVxlan(PNET_BUFFER_LIST curNbl,
IPHdr *ipHdr;
UDPHdr *udpHdr;
VXLANHdr *vxlanHdr;
+ POVS_VXLAN_VPORT vportVxlan;
UINT32 headRoom = OvsGetVxlanTunHdrSize();
UINT32 packetLength;
@@ -211,6 +213,10 @@ OvsDoEncapVxlan(PNET_BUFFER_LIST curNbl,
}
}
}
+
+ vportVxlan = (POVS_VXLAN_VPORT) GetOvsVportPriv(vport);
+ ASSERT(vportVxlan);
+
/* If we didn't split the packet above, make a copy now */
if (*newNbl == NULL) {
*newNbl = OvsPartialCopyNBL(switchContext, curNbl, 0, headRoom,
@@ -274,7 +280,7 @@ OvsDoEncapVxlan(PNET_BUFFER_LIST curNbl,
/* UDP header */
udpHdr = (UDPHdr *)((PCHAR)ipHdr + sizeof *ipHdr);
udpHdr->source = htons(tunKey->flow_hash | 32768);
- udpHdr->dest = htons(tunKey->dst_port);
+ udpHdr->dest = htons(vportVxlan->dstPort);
udpHdr->len = htons(NET_BUFFER_DATA_LENGTH(curNb) - headRoom +
sizeof *udpHdr + sizeof *vxlanHdr);
udpHdr->check = 0;
@@ -308,7 +314,8 @@ ret_error:
*----------------------------------------------------------------------------
*/
NDIS_STATUS
-OvsEncapVxlan(PNET_BUFFER_LIST curNbl,
+OvsEncapVxlan(POVS_VPORT_ENTRY vport,
+ PNET_BUFFER_LIST curNbl,
OvsIPv4TunnelKey *tunKey,
POVS_SWITCH_CONTEXT switchContext,
POVS_PACKET_HDR_INFO layers,
@@ -331,48 +338,10 @@ OvsEncapVxlan(PNET_BUFFER_LIST curNbl,
return NDIS_STATUS_FAILURE;
}
- return OvsDoEncapVxlan(curNbl, tunKey, &fwdInfo, layers,
+ return OvsDoEncapVxlan(vport, curNbl, tunKey, &fwdInfo, layers,
switchContext, newNbl);
}
-
-/*
- *----------------------------------------------------------------------------
- * OvsIpHlprCbVxlan --
- * Callback function for IP helper.
- * XXX: not used currently
- *----------------------------------------------------------------------------
- */
-static VOID
-OvsIpHlprCbVxlan(PNET_BUFFER_LIST curNbl,
- UINT32 inPort,
- OvsIPv4TunnelKey *tunKey,
- PVOID cbData1,
- PVOID cbData2,
- NTSTATUS result,
- POVS_FWD_INFO fwdInfo)
-{
- OVS_PACKET_HDR_INFO layers;
- OvsFlowKey key;
- NDIS_STATUS status;
- UNREFERENCED_PARAMETER(inPort);
-
- status = OvsExtractFlow(curNbl, inPort, &key, &layers, NULL);
- if (result == STATUS_SUCCESS) {
- status = OvsDoEncapVxlan(curNbl, tunKey, fwdInfo, &layers,
- (POVS_SWITCH_CONTEXT)cbData1, NULL);
- } else {
- status = NDIS_STATUS_FAILURE;
- }
-
- if (status != NDIS_STATUS_SUCCESS) {
- // XXX: Free up the NBL;
- return;
- }
-
- OvsLookupFlowOutput((POVS_SWITCH_CONTEXT)cbData1, cbData2, curNbl);
-}
-
/*
*----------------------------------------------------------------------------
* OvsCalculateUDPChecksum