[PATCH] fix IP conntrack+VLAN+bridging problem (was Re: Next problems with ip_conntrack and vlan on 2.6.x)

Bart De Schuymer <[email protected]>
Newsgroups gmane.linux.network.bridge.ebtables.devel
Message-ID <[email protected]>
On Wednesday 19 May 2004 15:57, Adam Osuchowski wrote:
> There is a problem with parentheses. This how it has been
> applied (net/ipv4/ip_output.c):
>
> ll_rs = LL_RESERVED_SPACE(rt->u.dst.dev + nf_bridge_pad(skb))
>
> This expands to:
>
> ll_rs = ((rt->u.dst.dev + nf_bridge_pad(skb))->hard_header_len &
> ~(HH_DATA_MOD - 1)) + HH_DATA_MOD
>
> But, this is how it should look like (after macrodefinition expanding):
>
> ll_rs = ((rt->u.dst.dev->hard_header_len + nf_bridge_pad(skb)) &
> ~(HH_DATA_MOD - 1)) + HH_DATA_MOD
>
> Regards,
> Adam Osuchowski
> Tomasz Dubinski

You are absolutely right.
Dave, please consider applying the patch below which fixes this bug.

cheers,
Bart

--- linux-2.6.6/include/linux/netdevice.h.old	2004-05-21 11:54:56.000000000 +0200
+++ linux-2.6.6/include/linux/netdevice.h	2004-05-21 11:58:08.000000000 +0200
@@ -215,6 +215,8 @@ struct hh_cache
  */
 #define LL_RESERVED_SPACE(dev) \
 	(((dev)->hard_header_len&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
+#define LL_RESERVED_SPACE_EXTRA(dev,extra) \
+	((((dev)->hard_header_len+extra)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
 
 /* These flag bits are private to the generic network queueing
  * layer, they may not be explicitly referenced by any other
--- linux-2.6.6/net/ipv4/ip_output.c.old	2004-05-21 11:54:00.000000000 +0200
+++ linux-2.6.6/net/ipv4/ip_output.c	2004-05-21 11:54:35.000000000 +0200
@@ -567,7 +567,7 @@ slow_path:
 #ifdef CONFIG_BRIDGE_NETFILTER
 	/* for bridged IP traffic encapsulated inside f.e. a vlan header,
 	 * we need to make room for the encapsulating header */
-	ll_rs = LL_RESERVED_SPACE(rt->u.dst.dev + nf_bridge_pad(skb));
+	ll_rs = LL_RESERVED_SPACE_EXTRA(rt->u.dst.dev, nf_bridge_pad(skb));
 	mtu -= nf_bridge_pad(skb);
 #else
 	ll_rs = LL_RESERVED_SPACE(rt->u.dst.dev);



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.