Skip to content

Commit

Permalink
datapath-windows: Fix IP fragmentation
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Nithin Raju <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
Alin Serdean authored and blp committed Oct 2, 2015
1 parent 21c5b0f commit 84173c8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
6 changes: 0 additions & 6 deletions datapath-windows/ovsext/DpInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
6 changes: 3 additions & 3 deletions datapath-windows/ovsext/Flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions datapath-windows/ovsext/PacketParser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 84173c8

Please sign in to comment.