Skip to content

Commit 9d6acb3

Browse files
congwangdavem330
authored andcommitted
ipv6: ignore null_entry in inet6_rtm_getroute() too
Like commit 1f17e2f ("net: ipv6: ignore null_entry on route dumps"), we need to ignore null entry in inet6_rtm_getroute() too. Return -ENETUNREACH here to sync with IPv4 behavior, as suggested by David. Fixes: a1a22c1 ("net: ipv6: Keep nexthop of multipath route on admin down") Reported-by: Dmitry Vyukov <[email protected]> Cc: David Ahern <[email protected]> Signed-off-by: Cong Wang <[email protected]> Acked-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent be12502 commit 9d6acb3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

net/ipv6/route.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3632,6 +3632,12 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh)
36323632
rt = (struct rt6_info *)ip6_route_output(net, NULL, &fl6);
36333633
}
36343634

3635+
if (rt == net->ipv6.ip6_null_entry) {
3636+
err = rt->dst.error;
3637+
ip6_rt_put(rt);
3638+
goto errout;
3639+
}
3640+
36353641
skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
36363642
if (!skb) {
36373643
ip6_rt_put(rt);

0 commit comments

Comments
 (0)