netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nf v2] netfilter: bridge: fix routing of bridge frames with call-iptables=1
@ 2015-09-14 15:06 Florian Westphal
  2015-09-14 19:03 ` Sander Eikelenboom
  2015-09-16 14:57 ` Pablo Neira Ayuso
  0 siblings, 2 replies; 3+ messages in thread
From: Florian Westphal @ 2015-09-14 15:06 UTC (permalink / raw)
  To: netfilter-devel; +Cc: linux, Florian Westphal

We can't re-use the physoutdev storage area.

1.  When using NFQUEUE in PREROUTING, we attempt to bump a bogus
refcnt since nf_bridge->physoutdev is garbage (ipv4/ipv6 address)

2. for same reason, we crash in physdev match in FORWARD or later if
skb is routed instead of bridged.

This increases nf_bridge_info to 40 bytes, but we have no other choice.

Fixes: 72b1e5e4cac7 ("netfilter: bridge: reduce nf_bridge_info to 32 bytes again")
Reported-by: Sander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
Either
- hard-reset nf.git to obliterate the v1 of the patch, then
apply this one instead, OR,
- revert v1 and apply this on top.

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 2738d35..9987af0 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -179,6 +179,9 @@ struct nf_bridge_info {
 	u8			bridged_dnat:1;
 	__u16			frag_max_size;
 	struct net_device	*physindev;
+
+	/* always valid & non-NULL from FORWARD on, for physdev match */
+	struct net_device	*physoutdev;
 	union {
 		/* prerouting: detect dnat in orig/reply direction */
 		__be32          ipv4_daddr;
@@ -189,9 +192,6 @@ struct nf_bridge_info {
 		 * skb is out in neigh layer.
 		 */
 		char neigh_header[8];
-
-		/* always valid & non-NULL from FORWARD on, for physdev match */
-		struct net_device *physoutdev;
 	};
 };
 #endif
-- 
2.0.5


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

* Re: [PATCH nf v2] netfilter: bridge: fix routing of bridge frames with call-iptables=1
  2015-09-14 15:06 [PATCH nf v2] netfilter: bridge: fix routing of bridge frames with call-iptables=1 Florian Westphal
@ 2015-09-14 19:03 ` Sander Eikelenboom
  2015-09-16 14:57 ` Pablo Neira Ayuso
  1 sibling, 0 replies; 3+ messages in thread
From: Sander Eikelenboom @ 2015-09-14 19:03 UTC (permalink / raw)
  To: Florian Westphal; +Cc: netfilter-devel

On 2015-09-14 17:06, Florian Westphal wrote:
> We can't re-use the physoutdev storage area.
> 
> 1.  When using NFQUEUE in PREROUTING, we attempt to bump a bogus
> refcnt since nf_bridge->physoutdev is garbage (ipv4/ipv6 address)
> 
> 2. for same reason, we crash in physdev match in FORWARD or later if
> skb is routed instead of bridged.
> 
> This increases nf_bridge_info to 40 bytes, but we have no other choice.
> 
> Fixes: 72b1e5e4cac7 ("netfilter: bridge: reduce nf_bridge_info to 32
> bytes again")
> Reported-by: Sander Eikelenboom <linux@eikelenboom.it>
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
> Either
> - hard-reset nf.git to obliterate the v1 of the patch, then
> apply this one instead, OR,
> - revert v1 and apply this on top.

re-tested, and for my case this patch also works, thx again !
--
Sander

> 
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index 2738d35..9987af0 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -179,6 +179,9 @@ struct nf_bridge_info {
>  	u8			bridged_dnat:1;
>  	__u16			frag_max_size;
>  	struct net_device	*physindev;
> +
> +	/* always valid & non-NULL from FORWARD on, for physdev match */
> +	struct net_device	*physoutdev;
>  	union {
>  		/* prerouting: detect dnat in orig/reply direction */
>  		__be32          ipv4_daddr;
> @@ -189,9 +192,6 @@ struct nf_bridge_info {
>  		 * skb is out in neigh layer.
>  		 */
>  		char neigh_header[8];
> -
> -		/* always valid & non-NULL from FORWARD on, for physdev match */
> -		struct net_device *physoutdev;
>  	};
>  };
>  #endif

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

* Re: [PATCH nf v2] netfilter: bridge: fix routing of bridge frames with call-iptables=1
  2015-09-14 15:06 [PATCH nf v2] netfilter: bridge: fix routing of bridge frames with call-iptables=1 Florian Westphal
  2015-09-14 19:03 ` Sander Eikelenboom
@ 2015-09-16 14:57 ` Pablo Neira Ayuso
  1 sibling, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2015-09-16 14:57 UTC (permalink / raw)
  To: Florian Westphal; +Cc: netfilter-devel, linux

On Mon, Sep 14, 2015 at 05:06:27PM +0200, Florian Westphal wrote:
> We can't re-use the physoutdev storage area.
> 
> 1.  When using NFQUEUE in PREROUTING, we attempt to bump a bogus
> refcnt since nf_bridge->physoutdev is garbage (ipv4/ipv6 address)
> 
> 2. for same reason, we crash in physdev match in FORWARD or later if
> skb is routed instead of bridged.
> 
> This increases nf_bridge_info to 40 bytes, but we have no other choice.

Applied, thanks.

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

end of thread, other threads:[~2015-09-16 14:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-14 15:06 [PATCH nf v2] netfilter: bridge: fix routing of bridge frames with call-iptables=1 Florian Westphal
2015-09-14 19:03 ` Sander Eikelenboom
2015-09-16 14:57 ` Pablo Neira Ayuso

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).