Netdev List
 help / color / mirror / Atom feed
From: Justin Pettit <jpettit@ovn.org>
To: netdev@vger.kernel.org, Pravin Shelar <pshelar@ovn.org>
Cc: Joe Stringer <joe@wand.net.nz>
Subject: [PATCH net 1/2] openvswitch: Properly set L4 keys on "later" IP fragments.
Date: Sat, 24 Aug 2019 09:58:45 -0700	[thread overview]
Message-ID: <20190824165846.79627-1-jpettit@ovn.org> (raw)

When IP fragments are reassembled before being sent to conntrack, the
key from the last fragment is used.  Unless there are reordering
issues, the last fragment received will not contain the L4 ports, so the
key for the reassembled datagram won't contain them.  This patch updates
the key once we have a reassembled datagram.

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

diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c
index 848c6eb55064..f40ad2a42086 100644
--- a/net/openvswitch/conntrack.c
+++ b/net/openvswitch/conntrack.c
@@ -524,6 +524,10 @@ static int handle_fragments(struct net *net, struct sw_flow_key *key,
 		return -EPFNOSUPPORT;
 	}
 
+	/* The key extracted from the fragment that completed this datagram
+	 * likely didn't have an L4 header, so regenerate it. */
+	ovs_flow_key_update(skb, key);
+
 	key->ip.frag = OVS_FRAG_TYPE_NONE;
 	skb_clear_hash(skb);
 	skb->ignore_df = 1;
-- 
2.17.1


             reply	other threads:[~2019-08-24 16:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-24 16:58 Justin Pettit [this message]
2019-08-24 16:58 ` [PATCH net 2/2] openvswitch: Clear the L4 portion of the key for "later" fragments Justin Pettit
2019-08-25 17:00   ` Pravin Shelar
2019-08-25 16:54 ` [PATCH net 1/2] openvswitch: Properly set L4 keys on "later" IP fragments Pravin Shelar
2019-08-25 20:40   ` Pravin Shelar
2019-08-25 21:52     ` David Miller
2019-08-26 18:42     ` Justin Pettit

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=20190824165846.79627-1-jpettit@ovn.org \
    --to=jpettit@ovn.org \
    --cc=joe@wand.net.nz \
    --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