On 5/3/17 11:02 AM, Cong Wang wrote:
> A quick glance shows we need to simply check local->rt6i_idev
> since we do the same check for sprt right above.

As I recall, rt6i_idev is set for all routes except null_entry and it is
not set on null_entry only because of initialization order.

> 
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index a1bf426..61ec3c8 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -511,7 +511,7 @@ static inline struct rt6_info
> *rt6_device_match(struct net *net,
>                                     sprt->rt6i_idev->dev->ifindex != oif) {
>                                         if (flags & RT6_LOOKUP_F_IFACE)
>                                                 continue;
> -                                       if (local &&
> +                                       if (local && local->rt6i_idev &&
> 
> local->rt6i_idev->dev->ifindex == oif)
>                                                 continue;
>                                 }
> 

Or don't consider null_entry at all:


@@ -515,7 +528,8 @@ static inline struct rt6_info
*rt6_device_match(struct net *net,

local->rt6i_idev->dev->ifindex == oif)
                                                continue;
                                }
-                               local = sprt;
+                               if (sprt != net->ipv6.ip6_null_entry)
+                                       local = sprt;
                        }

Reply via email to