summaryrefslogtreecommitdiff
path: root/datapath-windows
diff options
context:
space:
mode:
authorWilson Peng <pweisong@vmware.com>2021-07-20 00:23:57 -0700
committerAlin-Gabriel Serdean <aserdean@ovn.org>2021-07-21 12:59:06 +0300
commit8e808e7f149f88427242ec0e60f2b003d37d1e47 (patch)
treef0e6cca7cdf6adb1fee20a339c248ab97ce6afdc /datapath-windows
parent95479875265f341b0892b55c06036ffa615dc9da (diff)
downloadopenvswitch-8e808e7f149f88427242ec0e60f2b003d37d1e47.tar.gz
datapath-windows:Correct checksum for DNAT action
While testing OVS-windows flows for the DNAT action, the checksum In TCP header is set incorrectly when TCP offload is enabled by Default. As a result, the packet will be dropped on receiver linuxVM. >>>sample flow default configuration on both Windows VM and Linux VM (src=40.0.1.2,dst=10.150.0.1) --dnat--> (src=40.0.1.2,dst==30.1.0.2) Without the fix for some TCP packet(40.0.1.2->30.1.0.2 with payload len 207) the TCP checksum will be pseduo header checksum and the value is 0x01d6. With the fix the checksum will be 0x47ee, it could be got the correct TCP checksum on the receiver Linux VM. Signed-off-by: Wilson Peng<pweisong@vmware.com> Signed-off-by: Anand Kumar<kumaranand@vmware.com> Acked-by: Alin-Gabriel Serdean <aserdean@ovn.org> Signed-off-by: Alin-Gabriel Serdean <aserdean@ovn.org>
Diffstat (limited to 'datapath-windows')
-rw-r--r--datapath-windows/ovsext/Actions.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/datapath-windows/ovsext/Actions.c b/datapath-windows/ovsext/Actions.c
index 4f4336984..e130c2f96 100644
--- a/datapath-windows/ovsext/Actions.c
+++ b/datapath-windows/ovsext/Actions.c
@@ -1550,9 +1550,21 @@ OvsUpdateAddressAndPort(OvsForwardingContext *ovsFwdCtx,
if (tcpHdr) {
portField = &tcpHdr->dest;
checkField = &tcpHdr->check;
+ l4Offload = isTx ? (BOOLEAN)csumInfo.Transmit.TcpChecksum :
+ ((BOOLEAN)csumInfo.Receive.TcpChecksumSucceeded ||
+ (BOOLEAN)csumInfo.Receive.TcpChecksumFailed);
} else if (udpHdr) {
portField = &udpHdr->dest;
checkField = &udpHdr->check;
+ l4Offload = isTx ? (BOOLEAN)csumInfo.Transmit.UdpChecksum :
+ ((BOOLEAN)csumInfo.Receive.UdpChecksumSucceeded ||
+ (BOOLEAN)csumInfo.Receive.UdpChecksumFailed);
+ }
+
+ if (l4Offload) {
+ *checkField = IPPseudoChecksum(&ipHdr->saddr, &newAddr,
+ tcpHdr ? IPPROTO_TCP : IPPROTO_UDP,
+ ntohs(ipHdr->tot_len) - ipHdr->ihl * 4);
}
}