From patchwork Tue Sep 22 23:21:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alin Serdean X-Patchwork-Id: 521481 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (unknown [IPv6:2600:3c00::f03c:91ff:fe6e:bdf7]) by ozlabs.org (Postfix) with ESMTP id C22C914018C for ; Wed, 23 Sep 2015 09:22:13 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 9920C106E2; Tue, 22 Sep 2015 16:22:10 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v1.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 4D96C106B8 for ; Tue, 22 Sep 2015 16:22:09 -0700 (PDT) Received: from bar4.cudamail.com (bar2 [192.168.15.2]) by mx3v1.cudamail.com (Postfix) with ESMTP id EF2CF618C1F for ; Tue, 22 Sep 2015 17:22:07 -0600 (MDT) X-ASG-Debug-ID: 1442964124-03dc2110210d730001-byXFYA Received: from mx3-pf2.cudamail.com ([192.168.14.1]) by bar4.cudamail.com with ESMTP id US4vDliDmUBEgZgk (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 22 Sep 2015 17:22:04 -0600 (MDT) X-Barracuda-Envelope-From: aserdean@cloudbasesolutions.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.1 Received: from unknown (HELO cbssmtp1.cloudbase.local) (91.232.152.5) by mx3-pf2.cudamail.com with SMTP; 22 Sep 2015 23:21:58 -0000 Received-SPF: pass (mx3-pf2.cudamail.com: SPF record at cloudbasesolutions.com designates 91.232.152.5 as permitted sender) X-Barracuda-Apparent-Source-IP: 91.232.152.5 X-Barracuda-RBL-IP: 91.232.152.5 Received: from localhost (localhost [127.0.0.1]) by cbssmtp1.cloudbase.local (Postfix) with ESMTP id DD6D7425E9 for ; Wed, 23 Sep 2015 02:21:57 +0300 (EEST) X-Virus-Scanned: amavisd-new at cloudbasesolutions.com Received: from cbssmtp1.cloudbase.local ([127.0.0.1]) by localhost (cbssmtp1.cloudbase.local [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6sIyi16y1wCV for ; Wed, 23 Sep 2015 02:21:37 +0300 (EEST) Received: from CBSEX1.cloudbase.local (unknown [10.77.78.3]) by cbssmtp1.cloudbase.local (Postfix) with ESMTP id 8473E42292 for ; Wed, 23 Sep 2015 02:21:37 +0300 (EEST) Received: from CBSEX1.cloudbase.local ([10.77.78.3]) by CBSEX1.cloudbase.local ([10.77.78.3]) with mapi id 14.03.0224.002; Wed, 23 Sep 2015 01:21:37 +0200 X-CudaMail-Envelope-Sender: aserdean@cloudbasesolutions.com From: Alin Serdean To: "dev@openvswitch.org" X-CudaMail-MID: CM-V2-921067402 X-CudaMail-DTE: 092215 X-CudaMail-Originating-IP: 91.232.152.5 Thread-Topic: [PATCH] datapath-windows: Fix IP fragmentation X-ASG-Orig-Subj: [##CM-V2-921067402##][PATCH] datapath-windows: Fix IP fragmentation Thread-Index: AQHQ9Y1tHP0icFEv2EqOfTxxHCEAcA== Date: Tue, 22 Sep 2015 23:21:36 +0000 Message-ID: <1442964108-12016-1-git-send-email-aserdean@cloudbasesolutions.com> Accept-Language: en-US, it-IT Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.77.78.1] MIME-Version: 1.0 X-GBUdb-Analysis: 0, 91.232.152.5, Ugly c=0.303425 p=-0.368421 Source Normal X-MessageSniffer-Rules: 0-0-0-7897-c X-Barracuda-Connect: UNKNOWN[192.168.14.1] X-Barracuda-Start-Time: 1442964124 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.60 X-Barracuda-Spam-Status: No, SCORE=0.60 using per-user scores of TAG_LEVEL=3.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=3.0 tests=BSF_RULE7568M, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.22804 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS Subject: [ovs-dev] [PATCH] datapath-windows: Fix IP fragmentation X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@openvswitch.org Sender: "dev" 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 Acked-by: Nithin Raju --- 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(-) 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; }