All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] netfilter: netfilter fixes
@ 2011-02-09 14:39 kaber
  2011-02-09 14:39 ` [PATCH 1/1] netfilter: nf_conntrack: set conntrack templates again if we return NF_REPEAT kaber
  2011-02-09 20:40 ` [PATCH 0/1] netfilter: netfilter fixes David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: kaber @ 2011-02-09 14:39 UTC (permalink / raw)
  To: davem; +Cc: netfilter-devel, netdev

Hi Dave,

following is a single netfilter fix for net-2.6.git, fixing use of conntrack
templates when TCP conntrack kills the current conntrack in TIME_WAIT state
in order to have the conntrack core create a fresh one, from Pablo.

Please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6.git master

Thanks!


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/1] netfilter: nf_conntrack: set conntrack templates again if we return NF_REPEAT
  2011-02-09 14:39 [PATCH 0/1] netfilter: netfilter fixes kaber
@ 2011-02-09 14:39 ` kaber
  2011-02-09 20:40 ` [PATCH 0/1] netfilter: netfilter fixes David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: kaber @ 2011-02-09 14:39 UTC (permalink / raw)
  To: davem; +Cc: netfilter-devel, netdev

From: Pablo Neira Ayuso <pablo@netfilter.org>

The TCP tracking code has a special case that allows to return
NF_REPEAT if we receive a new SYN packet while in TIME_WAIT state.

In this situation, the TCP tracking code destroys the existing
conntrack to start a new clean session.

[DESTROY] tcp      6 src=192.168.0.2 dst=192.168.1.2 sport=38925 dport=8000 src=192.168.1.2 dst=192.168.1.100 sport=8000 dport=38925 [ASSURED]
    [NEW] tcp      6 120 SYN_SENT src=192.168.0.2 dst=192.168.1.2 sport=38925 dport=8000 [UNREPLIED] src=192.168.1.2 dst=192.168.1.100 sport=8000 dport=38925

However, this is a problem for the iptables' CT target event filtering
which will not work in this case since the conntrack template will not
be there for the new session. To fix this, we reassign the conntrack
template to the packet if we return NF_REPEAT.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
 net/netfilter/nf_conntrack_core.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index e615119..84f4fcc 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -942,8 +942,15 @@ nf_conntrack_in(struct net *net, u_int8_t pf, unsigned int hooknum,
 	if (set_reply && !test_and_set_bit(IPS_SEEN_REPLY_BIT, &ct->status))
 		nf_conntrack_event_cache(IPCT_REPLY, ct);
 out:
-	if (tmpl)
-		nf_ct_put(tmpl);
+	if (tmpl) {
+		/* Special case: we have to repeat this hook, assign the
+		 * template again to this packet. We assume that this packet
+		 * has no conntrack assigned. This is used by nf_ct_tcp. */
+		if (ret == NF_REPEAT)
+			skb->nfct = (struct nf_conntrack *)tmpl;
+		else
+			nf_ct_put(tmpl);
+	}
 
 	return ret;
 }
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/1] netfilter: netfilter fixes
  2011-02-09 14:39 [PATCH 0/1] netfilter: netfilter fixes kaber
  2011-02-09 14:39 ` [PATCH 1/1] netfilter: nf_conntrack: set conntrack templates again if we return NF_REPEAT kaber
@ 2011-02-09 20:40 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2011-02-09 20:40 UTC (permalink / raw)
  To: kaber; +Cc: netfilter-devel, netdev

From: kaber@trash.net
Date: Wed,  9 Feb 2011 15:39:28 +0100

> Hi Dave,
> 
> following is a single netfilter fix for net-2.6.git, fixing use of conntrack
> templates when TCP conntrack kills the current conntrack in TIME_WAIT state
> in order to have the conntrack core create a fresh one, from Pablo.
> 
> Please pull from:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6.git master

Also pulled, thanks a lot.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/1] netfilter: netfilter fixes
  2010-06-15 14:48 kaber
@ 2010-06-15 18:59 ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2010-06-15 18:59 UTC (permalink / raw)
  To: kaber; +Cc: netfilter-devel, netdev

From: kaber@trash.net
Date: Tue, 15 Jun 2010 16:48:04 +0200

> following is a single netfilter fix for IPVS from Sven Wegener, fixing a race
> condition that might result in an oops.
> 
> Please apply or pull from:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6.git master

Pulled, thanks Patrick.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 0/1] netfilter: netfilter fixes
@ 2010-06-15 14:48 kaber
  2010-06-15 18:59 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: kaber @ 2010-06-15 14:48 UTC (permalink / raw)
  To: davem; +Cc: netfilter-devel, netdev

Hi Dave,

following is a single netfilter fix for IPVS from Sven Wegener, fixing a race
condition that might result in an oops.

Please apply or pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6.git master

Thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-09 20:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-09 14:39 [PATCH 0/1] netfilter: netfilter fixes kaber
2011-02-09 14:39 ` [PATCH 1/1] netfilter: nf_conntrack: set conntrack templates again if we return NF_REPEAT kaber
2011-02-09 20:40 ` [PATCH 0/1] netfilter: netfilter fixes David Miller
  -- strict thread matches above, loose matches on Subject: below --
2010-06-15 14:48 kaber
2010-06-15 18:59 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.