Message ID | 1567145476-33802-1-git-send-email-wang.yi59@zte.com.cn |
---|---|
State | Rejected |
Delegated to: | David Miller |
Headers | show |
Series | [v3] ipv6: Not to probe neighbourless routes | expand |
From: Cheng Lin <wang.yi59@zte.com.cn> Date: Fri, 30 Aug 2019 14:11:16 +0800 > Originally, Router Reachability Probing require a neighbour entry > existed. Commit 2152caea7196 ("ipv6: Do not depend on rt->n in > rt6_probe().") removed the requirement for a neighbour entry. And > commit f547fac624be ("ipv6: rate-limit probes for neighbourless > routes") adds rate-limiting for neighbourless routes. I am not going to apply this patch. The reason we handle neighbourless routes is because due to the disconnect between routes and neighbour entries, we would lose information with your suggested change. Originally, all routes held a reference to a neighbour entry. Therefore we'd always have a neigh entry for any neigh message matching a route. But these two object pools (routes and neigh entries) are completely disconnected. We only look up a neigh entry when sending a packet on behalf of a route. Therfore, neigh entries can be purged arbitrarily even if hundreds of routes refer to them. And this means it is very important to accept and process probes even for neighbourless routes. I would also not recommend, in the future, reading RFC requirements literally without taking into consideration the details of Linux's specific implementation of ipv6 routing and neighbours. Thank you.
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 4b5656c..8c2e022 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h @@ -124,11 +124,6 @@ struct rt6_exception { struct fib6_nh { struct fib_nh_common nh_common; - -#ifdef CONFIG_IPV6_ROUTER_PREF - unsigned long last_probe; -#endif - struct rt6_info * __percpu *rt6i_pcpu; struct rt6_exception_bucket __rcu *rt6i_exception_bucket; }; diff --git a/net/ipv6/route.c b/net/ipv6/route.c index fd059e0..1839dd7 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -639,12 +639,12 @@ static void rt6_probe(struct fib6_nh *fib6_nh) 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); if (neigh) { if (neigh->nud_state & NUD_VALID) goto out; + idev = __in6_dev_get(dev); write_lock(&neigh->lock); if (!(neigh->nud_state & NUD_VALID) && time_after(jiffies, @@ -654,13 +654,9 @@ static void rt6_probe(struct fib6_nh *fib6_nh) __neigh_set_probe_once(neigh); } write_unlock(&neigh->lock); - } else if (time_after(jiffies, fib6_nh->last_probe + - idev->cnf.rtr_probe_interval)) { - work = kmalloc(sizeof(*work), GFP_ATOMIC); } if (work) { - fib6_nh->last_probe = jiffies; INIT_WORK(&work->work, rt6_probe_deferred); work->target = *nh_gw; dev_hold(dev);