Re: [PATCH] set fake_rtable's dst to NULL to avoid kernel Oops.

Eric Dumazet
2012-04-18T08:23:54Z

On Wed, 2012-04-18 at 15:57 +0800, Peter Huang(Peng) wrote:
> On 2012/4/18 0:48, Eric Dumazet wrote:
> > On Tue, 2012-04-17 at 08:52 -0700, Stephen Hemminger wrote:
> >
> >> This check seems like a disaster waiting to happen when the next
> >> change to DST table happens.
> >
> > Please Peter Document this, adding a new DST_FAKE_RTABLE flag
> >
> > #define DST_FAKE_RTABLE DST_NOPEER
> >
> > or just use a bit, we have plenty of them available.
> >
>
>
> Add DST_FAKE_RTABLE to dst_entry, this is the new patch.
> Is this ok?
>

A full new patch is needed, with nice changelog, and proper formatting
(your mail was mangled)

> };
>
> +static inline void br_drop_fake_rtable(struct sk_buff *skb) {
> + struct dst_entry *dst = skb_dst(skb);
> + /* abuse fact that only fake_rtable has DST_FAKE_RTABLE set */

Remove the comment, since we dont abuse NOPEER anymore, we use a
dedicated flag. (keep an empty line)

> + if (dst && (dst->flags & DST_FAKE_RTABLE))
> + skb_dst_drop(skb);
> +}
> +
> #else
> #define nf_bridge_maybe_copy_header(skb) (0)
> #define nf_bridge_pad(skb) (0)
> +#define br_drop_fake_rtable(skb) (0)
> #endif /* CONFIG_BRIDGE_NETFILTER */
>
> #endif /* __KERNEL__ */
> diff --git a/include/net/dst.h b/include/net/dst.h
> index 59c5d18..b094030 100644
> --- a/include/net/dst.h
> +++ b/include/net/dst.h
> @@ -55,6 +55,7 @@ struct dst_entry {
> #define DST_NOCACHE 0x0010
> #define DST_NOCOUNT 0x0020
> #define DST_NOPEER 0x0040
> +#define DST_FAKE_RTABLE 0x0080