Skip to content

Commit

Permalink
ipv4: Handle ipv6 gateway in fib_detect_death
Browse files Browse the repository at this point in the history
Update fib_detect_death to handle an ipv6 gateway.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David Ahern authored and David S. Miller committed Apr 8, 2019
1 parent 6de9c05 commit 619d182
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion net/ipv4/fib_semantics.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,10 +457,18 @@ static int fib_detect_death(struct fib_info *fi, int order,
struct fib_info **last_resort, int *last_idx,
int dflt)
{
const struct fib_nh_common *nhc = fib_info_nhc(fi, 0);
struct neighbour *n;
int state = NUD_NONE;

n = neigh_lookup(&arp_tbl, &fi->fib_nh[0].fib_nh_gw4, fi->fib_dev);
if (likely(nhc->nhc_gw_family == AF_INET))
n = neigh_lookup(&arp_tbl, &nhc->nhc_gw.ipv4, nhc->nhc_dev);
else if (nhc->nhc_gw_family == AF_INET6)
n = neigh_lookup(ipv6_stub->nd_tbl, &nhc->nhc_gw.ipv6,
nhc->nhc_dev);
else
n = NULL;

if (n) {
state = n->nud_state;
neigh_release(n);
Expand Down

0 comments on commit 619d182

Please sign in to comment.