diff mbox

[nf-next,v7,5/7] openvswitch: Handle NF_REPEAT in conntrack action.

Message ID 1454722865-59558-6-git-send-email-jarno@ovn.org
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show

Commit Message

Jarno Rajahalme Feb. 6, 2016, 1:41 a.m. UTC
Repeat the nf_conntrack_in() call when it returns NF_REPEAT.  This
avoids dropping a SYN packet re-opening an existing TCP connection.

Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
---
 net/openvswitch/conntrack.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Joe Stringer Feb. 17, 2016, 10:06 p.m. UTC | #1
On 5 February 2016 at 17:41, Jarno Rajahalme <jarno@ovn.org> wrote:
> Repeat the nf_conntrack_in() call when it returns NF_REPEAT.  This
> avoids dropping a SYN packet re-opening an existing TCP connection.
>
> Signed-off-by: Jarno Rajahalme <jarno@ovn.org>

Arguably this is a bugfix.

Acked-by: Joe Stringer <joe@ovn.org>
Pablo Neira Ayuso Feb. 18, 2016, 1:09 p.m. UTC | #2
On Wed, Feb 17, 2016 at 02:06:54PM -0800, Joe Stringer wrote:
> On 5 February 2016 at 17:41, Jarno Rajahalme <jarno@ovn.org> wrote:
> > Repeat the nf_conntrack_in() call when it returns NF_REPEAT.  This
> > avoids dropping a SYN packet re-opening an existing TCP connection.
> >
> > Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
> 
> Arguably this is a bugfix.
> 
> Acked-by: Joe Stringer <joe@ovn.org>

You can target this to the nf tree anytime if you want to see this fix
in mainline.
diff mbox

Patch

diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c
index c49e171..fa9ab25 100644
--- a/net/openvswitch/conntrack.c
+++ b/net/openvswitch/conntrack.c
@@ -476,6 +476,7 @@  static int __ovs_ct_lookup(struct net *net, struct sw_flow_key *key,
 	 */
 	if (!skb_nfct_cached(net, key, info, skb)) {
 		struct nf_conn *tmpl = info->ct;
+		int err;
 
 		/* Associate skb with specified zone. */
 		if (tmpl) {
@@ -486,8 +487,13 @@  static int __ovs_ct_lookup(struct net *net, struct sw_flow_key *key,
 			skb->nfctinfo = IP_CT_NEW;
 		}
 
-		if (nf_conntrack_in(net, info->family, NF_INET_PRE_ROUTING,
-				    skb) != NF_ACCEPT)
+		/* Repeat if requested, see nf_iterate(). */
+		do {
+			err = nf_conntrack_in(net, info->family,
+					      NF_INET_PRE_ROUTING, skb);
+		} while (err == NF_REPEAT);
+
+		if (err != NF_ACCEPT)
 			return -ENOENT;
 
 		ovs_ct_update_key(skb, info, key, true);