* [NETFILTER]: Fix skb->nf_bridge lifetime issues
@ 2006-02-20 7:44 Patrick McHardy
2006-02-20 9:33 ` Patrick McHardy
0 siblings, 1 reply; 6+ messages in thread
From: Patrick McHardy @ 2006-02-20 7:44 UTC (permalink / raw)
To: Bart De Schuymer
Cc: Linux Netdev List, Netfilter Development Mailinglist,
David S. Miller
[-- Attachment #1: Type: text/plain, Size: 361 bytes --]
Bart, can you please have a look at this patch and ACK/NACK it?
We have a bugreport in the netfilter bugzilla of broken conntrack
with tunnels on top of bridge devices (#448), which should be cured
by this patch.
There is also another report of broken conntrack with vlan on top
of bridge devices (#400) that looks related, but probably this
patch won't help.
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 3216 bytes --]
[NETFILTER]: Fix skb->nf_bridge lifetime issues
The bridge netfilter code simulates the NF_IP_PRE_ROUTING hook and skips
the real hook by registering with high priority and returning NF_STOP if
skb->nf_bridge is present and the BRNF_NF_BRIDGE_PREROUTING flag is not
set. The flag is only set during the simulated hook.
Because skb->nf_bridge is only freed when the packet is destroyed, the
packet will not only skip the first invocation of NF_IP_PRE_ROUTING, but
in the case of tunnel devices on top of the bridge also all further ones.
Forwarded packets from a bridge encapsulated by a tunnel device and sent
as locally outgoing packet will also still have the incorrect bridge
information from the input path attached.
We already have nf_reset calls on all RX/TX paths of tunnel devices,
so simply reset the nf_bridge field there too. As an added bonus,
the bridge information for locally delivered packets is now also freed
when the packet is queued to a socket.
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
commit 22e4dcb796d276db47a61c2382bdf2eaf76db32e
tree ccc5173acbe70506aa60e826e1881a4513f8c868
parent 337ba256a7e68f174a88ffba805b40622297fc22
author Patrick McHardy <kaber@trash.net> Mon, 20 Feb 2006 08:41:48 +0100
committer Patrick McHardy <kaber@trash.net> Mon, 20 Feb 2006 08:41:48 +0100
include/linux/skbuff.h | 24 ++++++++++++++----------
net/ipv4/netfilter/ipt_REJECT.c | 4 ----
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 838ce0f..65bf1fa 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1351,16 +1351,6 @@ static inline void nf_conntrack_put_reas
kfree_skb(skb);
}
#endif
-static inline void nf_reset(struct sk_buff *skb)
-{
- nf_conntrack_put(skb->nfct);
- skb->nfct = NULL;
-#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
- nf_conntrack_put_reasm(skb->nfct_reasm);
- skb->nfct_reasm = NULL;
-#endif
-}
-
#ifdef CONFIG_BRIDGE_NETFILTER
static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge)
{
@@ -1373,6 +1363,20 @@ static inline void nf_bridge_get(struct
atomic_inc(&nf_bridge->use);
}
#endif /* CONFIG_BRIDGE_NETFILTER */
+static inline void nf_reset(struct sk_buff *skb)
+{
+ nf_conntrack_put(skb->nfct);
+ skb->nfct = NULL;
+#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
+ nf_conntrack_put_reasm(skb->nfct_reasm);
+ skb->nfct_reasm = NULL;
+#endif
+#ifdef CONFIG_BRIDGE_NETFILTER
+ nf_bridge_put(skb->nfct);
+ skb->nfct = NULL;
+#endif
+}
+
#else /* CONFIG_NETFILTER */
static inline void nf_reset(struct sk_buff *skb) {}
#endif /* CONFIG_NETFILTER */
diff --git a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c
index 26ea6c1..9d3b357 100644
--- a/net/ipv4/netfilter/ipt_REJECT.c
+++ b/net/ipv4/netfilter/ipt_REJECT.c
@@ -154,10 +154,6 @@ static void send_reset(struct sk_buff *o
/* This packet will not be the same as the other: clear nf fields */
nf_reset(nskb);
nskb->nfmark = 0;
-#ifdef CONFIG_BRIDGE_NETFILTER
- nf_bridge_put(nskb->nf_bridge);
- nskb->nf_bridge = NULL;
-#endif
tcph = (struct tcphdr *)((u_int32_t*)nskb->nh.iph + nskb->nh.iph->ihl);
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [NETFILTER]: Fix skb->nf_bridge lifetime issues
2006-02-20 7:44 [NETFILTER]: Fix skb->nf_bridge lifetime issues Patrick McHardy
@ 2006-02-20 9:33 ` Patrick McHardy
2006-02-20 17:56 ` Bart De Schuymer
2006-02-21 4:09 ` David S. Miller
0 siblings, 2 replies; 6+ messages in thread
From: Patrick McHardy @ 2006-02-20 9:33 UTC (permalink / raw)
To: Bart De Schuymer
Cc: Linux Netdev List, Netfilter Development Mailinglist,
David S. Miller
[-- Attachment #1: Type: text/plain, Size: 673 bytes --]
Patrick McHardy wrote:
> Bart, can you please have a look at this patch and ACK/NACK it?
> We have a bugreport in the netfilter bugzilla of broken conntrack
> with tunnels on top of bridge devices (#448), which should be cured
> by this patch.
>
> +static inline void nf_reset(struct sk_buff *skb)
> +{
> + nf_conntrack_put(skb->nfct);
> + skb->nfct = NULL;
> +#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
> + nf_conntrack_put_reasm(skb->nfct_reasm);
> + skb->nfct_reasm = NULL;
> +#endif
> +#ifdef CONFIG_BRIDGE_NETFILTER
> + nf_bridge_put(skb->nfct);
> + skb->nfct = NULL;
> +#endif
> +}
This time compile tested and s/nfct/nf_bridge/ above.
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 3226 bytes --]
[NETFILTER]: Fix skb->nf_bridge lifetime issues
The bridge netfilter code simulates the NF_IP_PRE_ROUTING hook and skips
the real hook by registering with high priority and returning NF_STOP if
skb->nf_bridge is present and the BRNF_NF_BRIDGE_PREROUTING flag is not
set. The flag is only set during the simulated hook.
Because skb->nf_bridge is only freed when the packet is destroyed, the
packet will not only skip the first invocation of NF_IP_PRE_ROUTING, but
in the case of tunnel devices on top of the bridge also all further ones.
Forwarded packets from a bridge encapsulated by a tunnel device and sent
as locally outgoing packet will also still have the incorrect bridge
information from the input path attached.
We already have nf_reset calls on all RX/TX paths of tunnel devices,
so simply reset the nf_bridge field there too. As an added bonus,
the bridge information for locally delivered packets is now also freed
when the packet is queued to a socket.
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
commit 5e5c34345f3ead2608e38d75f998dfeb7bb5df1c
tree 17bbdf2d4efc19888ec4fc0fd27c544677bd1949
parent 337ba256a7e68f174a88ffba805b40622297fc22
author Patrick McHardy <kaber@trash.net> Mon, 20 Feb 2006 10:33:14 +0100
committer Patrick McHardy <kaber@trash.net> Mon, 20 Feb 2006 10:33:14 +0100
include/linux/skbuff.h | 24 ++++++++++++++----------
net/ipv4/netfilter/ipt_REJECT.c | 4 ----
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 838ce0f..1a26110 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1351,16 +1351,6 @@ static inline void nf_conntrack_put_reas
kfree_skb(skb);
}
#endif
-static inline void nf_reset(struct sk_buff *skb)
-{
- nf_conntrack_put(skb->nfct);
- skb->nfct = NULL;
-#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
- nf_conntrack_put_reasm(skb->nfct_reasm);
- skb->nfct_reasm = NULL;
-#endif
-}
-
#ifdef CONFIG_BRIDGE_NETFILTER
static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge)
{
@@ -1373,6 +1363,20 @@ static inline void nf_bridge_get(struct
atomic_inc(&nf_bridge->use);
}
#endif /* CONFIG_BRIDGE_NETFILTER */
+static inline void nf_reset(struct sk_buff *skb)
+{
+ nf_conntrack_put(skb->nfct);
+ skb->nfct = NULL;
+#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
+ nf_conntrack_put_reasm(skb->nfct_reasm);
+ skb->nfct_reasm = NULL;
+#endif
+#ifdef CONFIG_BRIDGE_NETFILTER
+ nf_bridge_put(skb->nf_bridge);
+ skb->nf_bridge = NULL;
+#endif
+}
+
#else /* CONFIG_NETFILTER */
static inline void nf_reset(struct sk_buff *skb) {}
#endif /* CONFIG_NETFILTER */
diff --git a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c
index 26ea6c1..9d3b357 100644
--- a/net/ipv4/netfilter/ipt_REJECT.c
+++ b/net/ipv4/netfilter/ipt_REJECT.c
@@ -154,10 +154,6 @@ static void send_reset(struct sk_buff *o
/* This packet will not be the same as the other: clear nf fields */
nf_reset(nskb);
nskb->nfmark = 0;
-#ifdef CONFIG_BRIDGE_NETFILTER
- nf_bridge_put(nskb->nf_bridge);
- nskb->nf_bridge = NULL;
-#endif
tcph = (struct tcphdr *)((u_int32_t*)nskb->nh.iph + nskb->nh.iph->ihl);
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [NETFILTER]: Fix skb->nf_bridge lifetime issues
2006-02-20 9:33 ` Patrick McHardy
@ 2006-02-20 17:56 ` Bart De Schuymer
2006-02-21 4:09 ` David S. Miller
1 sibling, 0 replies; 6+ messages in thread
From: Bart De Schuymer @ 2006-02-20 17:56 UTC (permalink / raw)
To: Patrick McHardy
Cc: Linux Netdev List, Netfilter Development Mailinglist,
David S. Miller
Op ma, 20-02-2006 te 10:33 +0100, schreef Patrick McHardy:
> Patrick McHardy wrote:
> > Bart, can you please have a look at this patch and ACK/NACK it?
> > We have a bugreport in the netfilter bugzilla of broken conntrack
> > with tunnels on top of bridge devices (#448), which should be cured
> > by this patch.
Looks fine to me. Nice work.
cheers,
Bart
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [NETFILTER]: Fix skb->nf_bridge lifetime issues
2006-02-20 9:33 ` Patrick McHardy
2006-02-20 17:56 ` Bart De Schuymer
@ 2006-02-21 4:09 ` David S. Miller
2006-02-21 4:17 ` Patrick McHardy
1 sibling, 1 reply; 6+ messages in thread
From: David S. Miller @ 2006-02-21 4:09 UTC (permalink / raw)
To: kaber; +Cc: netdev, netfilter-devel, bdschuym
From: Patrick McHardy <kaber@trash.net>
Date: Mon, 20 Feb 2006 10:33:34 +0100
> This time compile tested and s/nfct/nf_bridge/ above.
Want me to push this into net-2.6 now that Bart has ACK'd it?
Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [NETFILTER]: Fix skb->nf_bridge lifetime issues
2006-02-21 4:09 ` David S. Miller
@ 2006-02-21 4:17 ` Patrick McHardy
2006-02-21 4:21 ` David S. Miller
0 siblings, 1 reply; 6+ messages in thread
From: Patrick McHardy @ 2006-02-21 4:17 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, netfilter-devel, bdschuym
David S. Miller wrote:
> From: Patrick McHardy <kaber@trash.net>
> Date: Mon, 20 Feb 2006 10:33:34 +0100
>
>
>>This time compile tested and s/nfct/nf_bridge/ above.
>
>
> Want me to push this into net-2.6 now that Bart has ACK'd it?
I think net-2.6.17 is better, the bridging stuff is really to
fragile for this to be sure it won't break anything and this
has never worked so far.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [NETFILTER]: Fix skb->nf_bridge lifetime issues
2006-02-21 4:17 ` Patrick McHardy
@ 2006-02-21 4:21 ` David S. Miller
0 siblings, 0 replies; 6+ messages in thread
From: David S. Miller @ 2006-02-21 4:21 UTC (permalink / raw)
To: kaber; +Cc: netdev, netfilter-devel, bdschuym
From: Patrick McHardy <kaber@trash.net>
Date: Tue, 21 Feb 2006 05:17:04 +0100
> I think net-2.6.17 is better, the bridging stuff is really to
> fragile for this to be sure it won't break anything and this
> has never worked so far.
Ok, done.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-02-21 4:21 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-20 7:44 [NETFILTER]: Fix skb->nf_bridge lifetime issues Patrick McHardy
2006-02-20 9:33 ` Patrick McHardy
2006-02-20 17:56 ` Bart De Schuymer
2006-02-21 4:09 ` David S. Miller
2006-02-21 4:17 ` Patrick McHardy
2006-02-21 4:21 ` David S. Miller
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).