Hi Cong, On Fri, Jul 21, 2017 at 11:42:46AM -0700, Cong Wang wrote: > On Thu, Jul 20, 2017 at 8:23 AM, Hangbin Liu <liuhang...@gmail.com> wrote: > > 2017-07-20 23:06 GMT+08:00 Hangbin Liu <liuhang...@gmail.com>: > >>> +++ b/net/ipv6/route.c > >>> @@ -3637,12 +3637,6 @@ static int inet6_rtm_getroute(struct sk_buff > >>> *in_skb, struct nlmsghdr *nlh, > >>> dst = ip6_route_lookup(net, &fl6, 0); > >>> > >>> rt = container_of(dst, struct rt6_info, dst); > >>> - if (rt->dst.error) { > >>> - err = rt->dst.error; > >>> - ip6_rt_put(rt); > >>> - goto errout; > >>> - } > >> > >> hmm... or instead of remove this check, should we check all the entry? Like > >> if ((rt->dst.error && rt != net->ipv6.ip6_null_entry && rt != > > ^^ mistake here > >> net->ipv6.ip6_blk_hole_entry) || > >> rt == net->ipv6.ip6_null_entry ) > > > > Sorry, there should be no need to check ip6_null_entry since the > > error is already > > -ENETUNREACH. So how about > > Hmm? All of these 3 entries have error set, right?? > So we should only check dst.error...
A question, since you have fixed the ip6_null_entry->rt6i_idev issue via ipv6: initialize route null entry in addrconf_init() ipv6: reorder ip6_route_dev_notifier after ipv6_dev_notf ipv6: only call ip6_route_dev_notify() once for NETDEV_UNREGISTER ipv6: avoid unregistering inet6_dev for loopback Do we still need this net->ipv6.ip6_null_entry check? How about remove all the checks? diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 4d30c96..b5e3fe0 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -3637,17 +3637,6 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, dst = ip6_route_lookup(net, &fl6, 0); rt = container_of(dst, struct rt6_info, dst); - if (rt->dst.error) { - err = rt->dst.error; - ip6_rt_put(rt); - goto errout; - } - - if (rt == net->ipv6.ip6_null_entry) { - err = rt->dst.error; - ip6_rt_put(rt); - goto errout; - } skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); if (!skb) { Before this patch: + ip netns exec client ip -6 route get 2003::1 RTNETLINK answers: Network is unreachable After this patch: + ip netns exec client ip -6 route get 2003::1 unreachable 2003::1 dev lo table unspec proto kernel src 2001::1 metric 4294967295 error -101 Thanks Hangbin