]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ipv4: Handle ipv6 gateway in fib_detect_death
authorDavid Ahern <dsahern@gmail.com>
Fri, 5 Apr 2019 23:30:37 +0000 (16:30 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Apr 2019 22:22:41 +0000 (15:22 -0700)
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>
net/ipv4/fib_semantics.c

index dd95725c318e446bb83e9ef44f15f7c184093b81..e5a6d431bfab03ef66749b2040c4c9d67ac68b48 100644 (file)
@@ -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);