]> git.proxmox.com Git - mirror_ovs.git/commitdiff
datapath-windows: Fix payload length calculation in Conntrack.h
authorAlin Gabriel Serdean <aserdean@ovn.org>
Wed, 19 Sep 2018 22:37:06 +0000 (01:37 +0300)
committerAlin Gabriel Serdean <aserdean@ovn.org>
Thu, 20 Sep 2018 14:49:32 +0000 (17:49 +0300)
The payload calculation in OvsGetTcpHeader is wrong:
`ntohs(ipHdr->tot_len) - expr` instead of `ntohs((ipHdr->tot_len) - expr)`.

We already have a macro for that calculation defined in NetProto.h so use it.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Anand Kumar <kumaranand@vmware.com>
datapath-windows/ovsext/Conntrack.h

index 4678ed0287ac59ec0db95654b68965b20e6e134b..c3d317fa1e0bbdeb989daaba9248b9d82d970fd4 100644 (file)
@@ -187,8 +187,7 @@ OvsGetTcpHeader(PNET_BUFFER_LIST nbl,
     tcp = (TCPHdr *)((PCHAR)ipHdr + ipHdr->ihl * 4);
     if (tcp->doff * 4 >= sizeof *tcp) {
         NdisMoveMemory(dest, tcp, sizeof(TCPHdr));
-        *tcpPayloadLen = ntohs((ipHdr->tot_len) - (ipHdr->ihl * 4) -
-                               (TCP_HDR_LEN(tcp)));
+        *tcpPayloadLen = TCP_DATA_LENGTH(ipHdr, tcp);
         return storage;
     }