From: David Ahern Date: Fri, 5 Apr 2019 23:30:38 +0000 (-0700) Subject: ipv4: Handle ipv6 gateway in fib_good_nh X-Git-Tag: Ubuntu-5.10.0-12.13~5442^2~214^2~3 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=1a38c43d319e745cf12055a266a1f459e2ba9ec3;p=mirror_ubuntu-hirsute-kernel.git ipv4: Handle ipv6 gateway in fib_good_nh Update fib_good_nh to handle an ipv6 gateway. Signed-off-by: David Ahern Signed-off-by: David S. Miller --- diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index e5a6d431bfab..c1ea138335a2 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -1909,8 +1909,14 @@ static bool fib_good_nh(const struct fib_nh *nh) rcu_read_lock_bh(); - n = __ipv4_neigh_lookup_noref(nh->fib_nh_dev, - (__force u32)nh->fib_nh_gw4); + if (likely(nh->fib_nh_gw_family == AF_INET)) + n = __ipv4_neigh_lookup_noref(nh->fib_nh_dev, + (__force u32)nh->fib_nh_gw4); + else if (nh->fib_nh_gw_family == AF_INET6) + n = __ipv6_neigh_lookup_noref_stub(nh->fib_nh_dev, + &nh->fib_nh_gw6); + else + n = NULL; if (n) state = n->nud_state;