2019-08-27 09:10:42

by Yi Wang

[permalink] [raw]
Subject: [PATCH] ipv6: Not to probe neighbourless routes

From: Cheng Lin <[email protected]>

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.

And, the Neighbor Discovery for IP version 6 (IPv6)(rfc4861) says,
"
7.2.5. Receipt of Neighbor Advertisements

When a valid Neighbor Advertisement is received (either solicited or
unsolicited), the Neighbor Cache is searched for the target's entry.
If no entry exists, the advertisement SHOULD be silently discarded.
There is no need to create an entry if none exists, since the
recipient has apparently not initiated any communication with the
target.
".

In rt6_probe(), just a Neighbor Solicitation message are transmited.
When receiving a Neighbor Advertisement, the node does nothing in a
Neighborless condition.

Not sure it's needed to create a neighbor entry in Router
Reachability Probing. And the Original way may be the right way.

This patch recover the requirement for a neighbour entry.

Signed-off-by: Cheng Lin <[email protected]>
---
include/net/ip6_fib.h | 5 -----
net/ipv6/route.c | 5 +----
2 files changed, 1 insertion(+), 9 deletions(-)

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..c4bcffc 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,9 +654,6 @@ 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) {
--
1.8.3.1


2019-08-27 15:23:44

by Eric Dumazet

[permalink] [raw]
Subject: Re: [PATCH] ipv6: Not to probe neighbourless routes



On 8/27/19 11:08 AM, Yi Wang wrote:
> From: Cheng Lin <[email protected]>
>
> 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.
>
> And, the Neighbor Discovery for IP version 6 (IPv6)(rfc4861) says,
> "
> 7.2.5. Receipt of Neighbor Advertisements
>
> When a valid Neighbor Advertisement is received (either solicited or
> unsolicited), the Neighbor Cache is searched for the target's entry.
> If no entry exists, the advertisement SHOULD be silently discarded.
> There is no need to create an entry if none exists, since the
> recipient has apparently not initiated any communication with the
> target.
> ".
>
> In rt6_probe(), just a Neighbor Solicitation message are transmited.
> When receiving a Neighbor Advertisement, the node does nothing in a
> Neighborless condition.
>
> Not sure it's needed to create a neighbor entry in Router
> Reachability Probing. And the Original way may be the right way.
>
> This patch recover the requirement for a neighbour entry.
>
> Signed-off-by: Cheng Lin <[email protected]>
> ---
> include/net/ip6_fib.h | 5 -----
> net/ipv6/route.c | 5 +----
> 2 files changed, 1 insertion(+), 9 deletions(-)
>
> 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..c4bcffc 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,9 +654,6 @@ 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) {
>

Have you really compiled this patch ?


2019-08-27 20:50:48

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] ipv6: Not to probe neighbourless routes


Nothing says "low quality patch submission" like:

net/ipv6/route.c: In function ?rt6_probe?:
net/ipv6/route.c:660:10: error: ?struct fib6_nh? has no member named ?last_probe?
fib6_nh->last_probe = jiffies;

"I did not even try to compile this"

2019-08-29 22:21:53

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] ipv6: Not to probe neighbourless routes

Hi Yi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.3-rc6 next-20190829]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Yi-Wang/ipv6-Not-to-probe-neighbourless-routes/20190830-025439
config: x86_64-rhel (attached as .config)
compiler: gcc-7 (Debian 7.4.0-11) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <[email protected]>

All errors (new ones prefixed by >>):

net/ipv6/route.c: In function 'rt6_probe':
>> net/ipv6/route.c:660:10: error: 'struct fib6_nh' has no member named 'last_probe'
fib6_nh->last_probe = jiffies;
^~

vim +660 net/ipv6/route.c

c2f17e827b4199 Hannes Frederic Sowa 2013-10-21 619
cc3a86c802f0ba David Ahern 2019-04-09 620 static void rt6_probe(struct fib6_nh *fib6_nh)
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 621 {
f547fac624be53 Sabrina Dubroca 2018-10-12 622 struct __rt6_probe_work *work = NULL;
5e670d844b2a4e David Ahern 2018-04-17 623 const struct in6_addr *nh_gw;
f2c31e32b378a6 Eric Dumazet 2011-07-29 624 struct neighbour *neigh;
5e670d844b2a4e David Ahern 2018-04-17 625 struct net_device *dev;
f547fac624be53 Sabrina Dubroca 2018-10-12 626 struct inet6_dev *idev;
5e670d844b2a4e David Ahern 2018-04-17 627
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 628 /*
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 629 * Okay, this does not seem to be appropriate
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 630 * for now, however, we need to check if it
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 631 * is really so; aka Router Reachability Probing.
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 632 *
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 633 * Router Reachability Probe MUST be rate-limited
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 634 * to no more than one per minute.
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 635 */
cc3a86c802f0ba David Ahern 2019-04-09 636 if (fib6_nh->fib_nh_gw_family)
7ff74a596b6aa4 YOSHIFUJI Hideaki / 吉藤英明 2013-01-17 637 return;
5e670d844b2a4e David Ahern 2018-04-17 638
cc3a86c802f0ba David Ahern 2019-04-09 639 nh_gw = &fib6_nh->fib_nh_gw6;
cc3a86c802f0ba David Ahern 2019-04-09 640 dev = fib6_nh->fib_nh_dev;
2152caea719657 YOSHIFUJI Hideaki / 吉藤英明 2013-01-17 641 rcu_read_lock_bh();
5e670d844b2a4e David Ahern 2018-04-17 642 neigh = __ipv6_neigh_lookup_noref(dev, nh_gw);
2152caea719657 YOSHIFUJI Hideaki / 吉藤英明 2013-01-17 643 if (neigh) {
8d6c31bf574177 Martin KaFai Lau 2015-07-24 644 if (neigh->nud_state & NUD_VALID)
8d6c31bf574177 Martin KaFai Lau 2015-07-24 645 goto out;
8d6c31bf574177 Martin KaFai Lau 2015-07-24 646
e3f0c73ec3f208 Cheng Lin 2019-08-27 647 idev = __in6_dev_get(dev);
2152caea719657 YOSHIFUJI Hideaki / 吉藤英明 2013-01-17 648 write_lock(&neigh->lock);
990edb428c2c85 Martin KaFai Lau 2015-07-24 649 if (!(neigh->nud_state & NUD_VALID) &&
990edb428c2c85 Martin KaFai Lau 2015-07-24 650 time_after(jiffies,
dcd1f572954f9d David Ahern 2018-04-18 651 neigh->updated + idev->cnf.rtr_probe_interval)) {
c2f17e827b4199 Hannes Frederic Sowa 2013-10-21 652 work = kmalloc(sizeof(*work), GFP_ATOMIC);
990edb428c2c85 Martin KaFai Lau 2015-07-24 653 if (work)
7e980569642811 Jiri Benc 2013-12-11 654 __neigh_set_probe_once(neigh);
990edb428c2c85 Martin KaFai Lau 2015-07-24 655 }
2152caea719657 YOSHIFUJI Hideaki / 吉藤英明 2013-01-17 656 write_unlock(&neigh->lock);
990edb428c2c85 Martin KaFai Lau 2015-07-24 657 }
2152caea719657 YOSHIFUJI Hideaki / 吉藤英明 2013-01-17 658
c2f17e827b4199 Hannes Frederic Sowa 2013-10-21 659 if (work) {
cc3a86c802f0ba David Ahern 2019-04-09 @660 fib6_nh->last_probe = jiffies;
c2f17e827b4199 Hannes Frederic Sowa 2013-10-21 661 INIT_WORK(&work->work, rt6_probe_deferred);
5e670d844b2a4e David Ahern 2018-04-17 662 work->target = *nh_gw;
5e670d844b2a4e David Ahern 2018-04-17 663 dev_hold(dev);
5e670d844b2a4e David Ahern 2018-04-17 664 work->dev = dev;
c2f17e827b4199 Hannes Frederic Sowa 2013-10-21 665 schedule_work(&work->work);
c2f17e827b4199 Hannes Frederic Sowa 2013-10-21 666 }
990edb428c2c85 Martin KaFai Lau 2015-07-24 667
8d6c31bf574177 Martin KaFai Lau 2015-07-24 668 out:
2152caea719657 YOSHIFUJI Hideaki / 吉藤英明 2013-01-17 669 rcu_read_unlock_bh();
f2c31e32b378a6 Eric Dumazet 2011-07-29 670 }
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 671 #else
cc3a86c802f0ba David Ahern 2019-04-09 672 static inline void rt6_probe(struct fib6_nh *fib6_nh)
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 673 {
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 674 }
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 675 #endif
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 676

:::::: The code at line 660 was first introduced by commit
:::::: cc3a86c802f0ba9a2627aef256d95ae3b3fa6e91 ipv6: Change rt6_probe to take a fib6_nh

:::::: TO: David Ahern <[email protected]>
:::::: CC: David S. Miller <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (6.07 kB)
.config.gz (42.50 kB)
Download all attachments

2019-08-29 22:44:13

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] ipv6: Not to probe neighbourless routes

Hi Yi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.3-rc6 next-20190829]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Yi-Wang/ipv6-Not-to-probe-neighbourless-routes/20190830-025439
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-7 (Debian 7.4.0-11) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <[email protected]>

All errors (new ones prefixed by >>):

net/ipv6/route.c: In function 'rt6_probe':
>> net/ipv6/route.c:660:10: error: 'struct fib6_nh' has no member named 'last_probe'
fib6_nh->last_probe = jiffies;
^~

vim +660 net/ipv6/route.c

c2f17e827b4199 Hannes Frederic Sowa 2013-10-21 619
cc3a86c802f0ba David Ahern 2019-04-09 620 static void rt6_probe(struct fib6_nh *fib6_nh)
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 621 {
f547fac624be53 Sabrina Dubroca 2018-10-12 622 struct __rt6_probe_work *work = NULL;
5e670d844b2a4e David Ahern 2018-04-17 623 const struct in6_addr *nh_gw;
f2c31e32b378a6 Eric Dumazet 2011-07-29 624 struct neighbour *neigh;
5e670d844b2a4e David Ahern 2018-04-17 625 struct net_device *dev;
f547fac624be53 Sabrina Dubroca 2018-10-12 626 struct inet6_dev *idev;
5e670d844b2a4e David Ahern 2018-04-17 627
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 628 /*
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 629 * Okay, this does not seem to be appropriate
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 630 * for now, however, we need to check if it
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 631 * is really so; aka Router Reachability Probing.
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 632 *
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 633 * Router Reachability Probe MUST be rate-limited
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 634 * to no more than one per minute.
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 635 */
cc3a86c802f0ba David Ahern 2019-04-09 636 if (fib6_nh->fib_nh_gw_family)
7ff74a596b6aa4 YOSHIFUJI Hideaki / 吉藤英明 2013-01-17 637 return;
5e670d844b2a4e David Ahern 2018-04-17 638
cc3a86c802f0ba David Ahern 2019-04-09 639 nh_gw = &fib6_nh->fib_nh_gw6;
cc3a86c802f0ba David Ahern 2019-04-09 640 dev = fib6_nh->fib_nh_dev;
2152caea719657 YOSHIFUJI Hideaki / 吉藤英明 2013-01-17 641 rcu_read_lock_bh();
5e670d844b2a4e David Ahern 2018-04-17 642 neigh = __ipv6_neigh_lookup_noref(dev, nh_gw);
2152caea719657 YOSHIFUJI Hideaki / 吉藤英明 2013-01-17 643 if (neigh) {
8d6c31bf574177 Martin KaFai Lau 2015-07-24 644 if (neigh->nud_state & NUD_VALID)
8d6c31bf574177 Martin KaFai Lau 2015-07-24 645 goto out;
8d6c31bf574177 Martin KaFai Lau 2015-07-24 646
e3f0c73ec3f208 Cheng Lin 2019-08-27 647 idev = __in6_dev_get(dev);
2152caea719657 YOSHIFUJI Hideaki / 吉藤英明 2013-01-17 648 write_lock(&neigh->lock);
990edb428c2c85 Martin KaFai Lau 2015-07-24 649 if (!(neigh->nud_state & NUD_VALID) &&
990edb428c2c85 Martin KaFai Lau 2015-07-24 650 time_after(jiffies,
dcd1f572954f9d David Ahern 2018-04-18 651 neigh->updated + idev->cnf.rtr_probe_interval)) {
c2f17e827b4199 Hannes Frederic Sowa 2013-10-21 652 work = kmalloc(sizeof(*work), GFP_ATOMIC);
990edb428c2c85 Martin KaFai Lau 2015-07-24 653 if (work)
7e980569642811 Jiri Benc 2013-12-11 654 __neigh_set_probe_once(neigh);
990edb428c2c85 Martin KaFai Lau 2015-07-24 655 }
2152caea719657 YOSHIFUJI Hideaki / 吉藤英明 2013-01-17 656 write_unlock(&neigh->lock);
990edb428c2c85 Martin KaFai Lau 2015-07-24 657 }
2152caea719657 YOSHIFUJI Hideaki / 吉藤英明 2013-01-17 658
c2f17e827b4199 Hannes Frederic Sowa 2013-10-21 659 if (work) {
cc3a86c802f0ba David Ahern 2019-04-09 @660 fib6_nh->last_probe = jiffies;
c2f17e827b4199 Hannes Frederic Sowa 2013-10-21 661 INIT_WORK(&work->work, rt6_probe_deferred);
5e670d844b2a4e David Ahern 2018-04-17 662 work->target = *nh_gw;
5e670d844b2a4e David Ahern 2018-04-17 663 dev_hold(dev);
5e670d844b2a4e David Ahern 2018-04-17 664 work->dev = dev;
c2f17e827b4199 Hannes Frederic Sowa 2013-10-21 665 schedule_work(&work->work);
c2f17e827b4199 Hannes Frederic Sowa 2013-10-21 666 }
990edb428c2c85 Martin KaFai Lau 2015-07-24 667
8d6c31bf574177 Martin KaFai Lau 2015-07-24 668 out:
2152caea719657 YOSHIFUJI Hideaki / 吉藤英明 2013-01-17 669 rcu_read_unlock_bh();
f2c31e32b378a6 Eric Dumazet 2011-07-29 670 }
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 671 #else
cc3a86c802f0ba David Ahern 2019-04-09 672 static inline void rt6_probe(struct fib6_nh *fib6_nh)
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 673 {
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 674 }
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 675 #endif
270972554c91ac YOSHIFUJI Hideaki 2006-03-20 676

:::::: The code at line 660 was first introduced by commit
:::::: cc3a86c802f0ba9a2627aef256d95ae3b3fa6e91 ipv6: Change rt6_probe to take a fib6_nh

:::::: TO: David Ahern <[email protected]>
:::::: CC: David S. Miller <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (6.08 kB)
.config.gz (67.88 kB)
Download all attachments

2019-08-29 23:38:55

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] ipv6: Not to probe neighbourless routes


So yeah, this is one instance where the kbuild test robot's report is
making more rather than less work for us.

We identified the build problem within hours of this patch being
posted and the updated version was posted more than 24 hours ago.

The kbuild robot should really have a way to either:

1) Report build problems faster, humans find the obvious cases like
this one within a day or less.

2) Notice that a new version of the patch was posted or that a human
responded to the patch pointing out the build problem.

Otherwise we get postings like this which is just more noise to
delete.

Thanks.

2019-08-30 00:57:46

by Philip Li

[permalink] [raw]
Subject: Re: [kbuild-all] [PATCH] ipv6: Not to probe neighbourless routes

On Thu, Aug 29, 2019 at 04:37:42PM -0700, David Miller wrote:
>
> So yeah, this is one instance where the kbuild test robot's report is
> making more rather than less work for us.
sorry for the inconvenience caused. We monitor the lkml, and as you
point out, we will continuously improve to provide faster response.

>
> We identified the build problem within hours of this patch being
> posted and the updated version was posted more than 24 hours ago.
>
> The kbuild robot should really have a way to either:
>
> 1) Report build problems faster, humans find the obvious cases like
> this one within a day or less.
thanks, we will continue working on this to speed up

>
> 2) Notice that a new version of the patch was posted or that a human
> responded to the patch pointing out the build problem.
thanks, we will enhance the patch testing to consider these ideas.

>
> Otherwise we get postings like this which is just more noise to
> delete.
>
> Thanks.
> _______________________________________________
> kbuild-all mailing list
> [email protected]
> https://lists.01.org/mailman/listinfo/kbuild-all