]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
bridge: netfilter: fix update_pmtu crash with GRE
authorHerbert Xu <herbert@gondor.apana.org.au>
Tue, 25 Nov 2008 00:06:50 +0000 (16:06 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 17 Mar 2009 00:52:41 +0000 (17:52 -0700)
[ Upstream commit 631339f1e544a4d39a63cfe6708c5bddcd5a2c48 ]

As GRE tries to call the update_pmtu function on skb->dst and
bridge supplies an skb->dst that has a NULL ops field, all is
not well.

This patch fixes this by giving the bridge device an ops field
with an update_pmtu function.  For the moment I've left all
other fields blank but we can fill them in later should the
need arise.

Based on report and patch by Philip Craig.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/bridge/br_netfilter.c

index 6a9a6cd74b1efa58e174dc03cab451b88d33be47..9abd45098f0a4076f783cc2e067f98bbf1f90edf 100644 (file)
@@ -101,6 +101,18 @@ static inline __be16 pppoe_proto(const struct sk_buff *skb)
         pppoe_proto(skb) == htons(PPP_IPV6) && \
         brnf_filter_pppoe_tagged)
 
+static void fake_update_pmtu(struct dst_entry *dst, u32 mtu)
+{
+}
+
+static struct dst_ops fake_dst_ops = {
+       .family =               AF_INET,
+       .protocol =             __constant_htons(ETH_P_IP),
+       .update_pmtu =          fake_update_pmtu,
+       .entry_size =           sizeof(struct rtable),
+       .entries =              ATOMIC_INIT(0),
+};
+
 /*
  * Initialize bogus route table used to keep netfilter happy.
  * Currently, we fill in the PMTU entry because netfilter
@@ -117,6 +129,7 @@ void br_netfilter_rtable_init(struct net_bridge *br)
        rt->u.dst.path = &rt->u.dst;
        rt->u.dst.metrics[RTAX_MTU - 1] = 1500;
        rt->u.dst.flags = DST_NOXFRM;
+       rt->u.dst.ops = &fake_dst_ops;
 }
 
 static inline struct rtable *bridge_parent_rtable(const struct net_device *dev)