netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Rose <gvrose8192@gmail.com>
To: netdev@vger.kernel.org, pshelar@ovn.org
Cc: joe@wand.net.nz, Justin Pettit <jpettit@ovn.org>
Subject: [PATCH V3 net 2/2] openvswitch: Clear the L4 portion of the key for "later" fragments.
Date: Tue, 27 Aug 2019 07:58:10 -0700	[thread overview]
Message-ID: <1566917890-22304-2-git-send-email-gvrose8192@gmail.com> (raw)
In-Reply-To: <1566917890-22304-1-git-send-email-gvrose8192@gmail.com>

From: Justin Pettit <jpettit@ovn.org>

Only the first fragment in a datagram contains the L4 headers.  When the
Open vSwitch module parses a packet, it always sets the IP protocol
field in the key, but can only set the L4 fields on the first fragment.
The original behavior would not clear the L4 portion of the key, so
garbage values would be sent in the key for "later" fragments.  This
patch clears the L4 fields in that circumstance to prevent sending those
garbage values as part of the upcall.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
---
 net/openvswitch/flow.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
index 005f762..9d81d2c 100644
--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -560,6 +560,7 @@ static int key_extract_l3l4(struct sk_buff *skb, struct sw_flow_key *key)
 		offset = nh->frag_off & htons(IP_OFFSET);
 		if (offset) {
 			key->ip.frag = OVS_FRAG_TYPE_LATER;
+			memset(&key->tp, 0, sizeof(key->tp));
 			return 0;
 		}
 		if (nh->frag_off & htons(IP_MF) ||
@@ -677,8 +678,10 @@ static int key_extract_l3l4(struct sk_buff *skb, struct sw_flow_key *key)
 			return error;
 		}
 
-		if (key->ip.frag == OVS_FRAG_TYPE_LATER)
+		if (key->ip.frag == OVS_FRAG_TYPE_LATER) {
+			memset(&key->tp, 0, sizeof(key->tp));
 			return 0;
+		}
 		if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP)
 			key->ip.frag = OVS_FRAG_TYPE_FIRST;
 
-- 
1.8.3.1


  reply	other threads:[~2019-08-27 14:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-27 14:58 [PATCH V3 net 1/2] openvswitch: Properly set L4 keys on "later" IP fragments Greg Rose
2019-08-27 14:58 ` Greg Rose [this message]
2019-08-28  0:33   ` [PATCH V3 net 2/2] openvswitch: Clear the L4 portion of the key for "later" fragments Pravin Shelar
2019-08-28 21:54   ` David Miller
2019-08-28  0:33 ` [PATCH V3 net 1/2] openvswitch: Properly set L4 keys on "later" IP fragments Pravin Shelar
2019-08-28  4:19   ` Gregory Rose
2019-08-28 21:54 ` David Miller
2019-08-28 23:47   ` Gregory Rose

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1566917890-22304-2-git-send-email-gvrose8192@gmail.com \
    --to=gvrose8192@gmail.com \
    --cc=joe@wand.net.nz \
    --cc=jpettit@ovn.org \
    --cc=netdev@vger.kernel.org \
    --cc=pshelar@ovn.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).