ipv6: Change rt6_probe to take a fib6_nh
authorDavid Ahern <dsahern@gmail.com>
Tue, 9 Apr 2019 21:41:12 +0000 (14:41 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 11 Apr 2019 21:24:06 +0000 (14:24 -0700)
rt6_probe sends probes for gateways in a nexthop. As such it really
depends on a fib6_nh, not a fib entry. Move last_probe to fib6_nh and
update rt6_probe to a fib6_nh struct.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/ip6_fib.h
net/ipv6/route.c

index 58dbb4e..2e9235a 100644 (file)
@@ -127,6 +127,10 @@ struct rt6_exception {
 
 struct fib6_nh {
        struct fib_nh_common    nh_common;
+
+#ifdef CONFIG_IPV6_ROUTER_PREF
+       unsigned long           last_probe;
+#endif
 };
 
 struct fib6_info {
@@ -155,10 +159,6 @@ struct fib6_info {
        struct rt6_info * __percpu      *rt6i_pcpu;
        struct rt6_exception_bucket __rcu *rt6i_exception_bucket;
 
-#ifdef CONFIG_IPV6_ROUTER_PREF
-       unsigned long                   last_probe;
-#endif
-
        u32                             fib6_metric;
        u8                              fib6_protocol;
        u8                              fib6_type;
index 9630339..c2b0d6f 100644 (file)
@@ -517,7 +517,7 @@ static void rt6_probe_deferred(struct work_struct *w)
        kfree(work);
 }
 
-static void rt6_probe(struct fib6_info *rt)
+static void rt6_probe(struct fib6_nh *fib6_nh)
 {
        struct __rt6_probe_work *work = NULL;
        const struct in6_addr *nh_gw;
@@ -533,11 +533,11 @@ static void rt6_probe(struct fib6_info *rt)
         * Router Reachability Probe MUST be rate-limited
         * to no more than one per minute.
         */
-       if (!rt || !rt->fib6_nh.fib_nh_gw_family)
+       if (fib6_nh->fib_nh_gw_family)
                return;
 
-       nh_gw = &rt->fib6_nh.fib_nh_gw6;
-       dev = rt->fib6_nh.fib_nh_dev;
+       nh_gw = &fib6_nh->fib_nh_gw6;
+       dev = fib6_nh->fib_nh_dev;
        rcu_read_lock_bh();
        idev = __in6_dev_get(dev);
        neigh = __ipv6_neigh_lookup_noref(dev, nh_gw);
@@ -554,13 +554,13 @@ static void rt6_probe(struct fib6_info *rt)
                                __neigh_set_probe_once(neigh);
                }
                write_unlock(&neigh->lock);
-       } else if (time_after(jiffies, rt->last_probe +
+       } else if (time_after(jiffies, fib6_nh->last_probe +
                                       idev->cnf.rtr_probe_interval)) {
                work = kmalloc(sizeof(*work), GFP_ATOMIC);
        }
 
        if (work) {
-               rt->last_probe = jiffies;
+               fib6_nh->last_probe = jiffies;
                INIT_WORK(&work->work, rt6_probe_deferred);
                work->target = *nh_gw;
                dev_hold(dev);
@@ -572,7 +572,7 @@ out:
        rcu_read_unlock_bh();
 }
 #else
-static inline void rt6_probe(struct fib6_info *rt)
+static inline void rt6_probe(struct fib6_nh *fib6_nh)
 {
 }
 #endif
@@ -657,7 +657,7 @@ static struct fib6_info *find_match(struct fib6_info *rt, int oif, int strict,
        }
 
        if (strict & RT6_LOOKUP_F_REACHABLE)
-               rt6_probe(rt);
+               rt6_probe(&rt->fib6_nh);
 
        /* note that m can be RT6_NUD_FAIL_PROBE at this point */
        if (m > *mpri) {