diff mbox

[ovs-dev] datapath-windows: Fix IP fragmentation

Message ID 1442964108-12016-1-git-send-email-aserdean@cloudbasesolutions.com
State Superseded
Headers show

Commit Message

Alin Serdean Sept. 22, 2015, 11:21 p.m. UTC
Currently in the case of IP fragmentation we send to the userspace that
the flag for the last fragment is 3 when it actually should be a value
between 0..2.

This patch fixes the problem and also uses the values used in the common
header of the datapath.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
---
This patch is intended for branch-2.4 as well
---
 datapath-windows/ovsext/DpInternal.h   | 6 ------
 datapath-windows/ovsext/Flow.c         | 6 +++---
 datapath-windows/ovsext/PacketParser.c | 6 +++---
 3 files changed, 6 insertions(+), 12 deletions(-)

Comments

Nithin Raju Sept. 30, 2015, 1:51 p.m. UTC | #1
> On Sep 22, 2015, at 4:21 PM, Alin Serdean <aserdean@cloudbasesolutions.com> wrote:
> 
> Currently in the case of IP fragmentation we send to the userspace that
> the flag for the last fragment is 3 when it actually should be a value
> between 0..2.
> 
> This patch fixes the problem and also uses the values used in the common
> header of the datapath.
> 
> Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
> ---
> This patch is intended for branch-2.4 as well
> ---

Acked-by: Nithin Raju <nithin@vmware.com>
diff mbox

Patch

diff --git a/datapath-windows/ovsext/DpInternal.h b/datapath-windows/ovsext/DpInternal.h
index 3da9d6a..8de48a2 100644
--- a/datapath-windows/ovsext/DpInternal.h
+++ b/datapath-windows/ovsext/DpInternal.h
@@ -62,12 +62,6 @@  typedef struct _OVS_VPORT_EXT_INFO {
  * that is, pure 802.2 frames. */
 #define OVSWIN_DL_TYPE_NONE 0x5ff
 
-/* Fragment bits, used for IPv4 and IPv6, always zero for non-IP flows. */
-#define OVSWIN_NW_FRAG_ANY   (1 << 0)   /* Set for any IP frag. */
-#define OVSWIN_NW_FRAG_LATER (1 << 1)   /* Set for IP frag with nonzero
-                                         * offset. */
-#define OVSWIN_NW_FRAG_MASK  (OVSWIN_NW_FRAG_ANY | OVSWIN_NW_FRAG_LATER)
-
 typedef struct L4Key {
     ovs_be16 tpSrc;              /* TCP/UDP/SCTP source port. */
     ovs_be16 tpDst;              /* TCP/UDP/SCTP destination port. */
diff --git a/datapath-windows/ovsext/Flow.c b/datapath-windows/ovsext/Flow.c
index 32cb086..b629c93 100644
--- a/datapath-windows/ovsext/Flow.c
+++ b/datapath-windows/ovsext/Flow.c
@@ -1785,12 +1785,12 @@  OvsExtractFlow(const NET_BUFFER_LIST *packet,
 
             ipKey->nwTos = nh->tos;
             if (nh->frag_off & htons(IP_MF | IP_OFFSET)) {
-                ipKey->nwFrag = OVSWIN_NW_FRAG_ANY;
+                ipKey->nwFrag = OVS_FRAG_TYPE_FIRST;
                 if (nh->frag_off & htons(IP_OFFSET)) {
-                    ipKey->nwFrag |= OVSWIN_NW_FRAG_LATER;
+                    ipKey->nwFrag = OVS_FRAG_TYPE_LATER;
                 }
             } else {
-                ipKey->nwFrag = 0;
+                ipKey->nwFrag = OVS_FRAG_TYPE_NONE;
             }
 
             ipKey->nwTtl = nh->ttl;
diff --git a/datapath-windows/ovsext/PacketParser.c b/datapath-windows/ovsext/PacketParser.c
index 2c955e1..e01be17 100644
--- a/datapath-windows/ovsext/PacketParser.c
+++ b/datapath-windows/ovsext/PacketParser.c
@@ -108,7 +108,7 @@  OvsParseIPv6(const NET_BUFFER_LIST *packet,
         ((nh->flow_lbl[0] & 0x0F) << 16) | (nh->flow_lbl[1] << 8) | nh->flow_lbl[2];
     flow->nwTtl = nh->hop_limit;
     flow->nwProto = SOCKET_IPPROTO_NONE;
-    flow->nwFrag = 0;
+    flow->nwFrag = OVS_FRAG_TYPE_NONE;
 
     // Parse extended headers and compute L4 offset
     ofs += sizeof(IPv6Hdr);
@@ -161,9 +161,9 @@  OvsParseIPv6(const NET_BUFFER_LIST *packet,
             /* We only process the first fragment. */
             if (fragHdr->offlg != htons(0)) {
                 if ((fragHdr->offlg & IP6F_OFF_HOST_ORDER_MASK) == htons(0)) {
-                    flow->nwFrag = OVSWIN_NW_FRAG_ANY;
+                    flow->nwFrag = OVS_FRAG_TYPE_FIRST;
                 } else {
-                    flow->nwFrag |= OVSWIN_NW_FRAG_LATER;
+                    flow->nwFrag = OVS_FRAG_TYPE_LATER;
                     nextHdr = SOCKET_IPPROTO_FRAGMENT;
                     break;
                 }