* [PATCH net] route: check sysctl_fib_multipath_use_neigh earlier than hash
@ 2018-04-01 14:40 Xin Long
2018-04-01 16:19 ` David Ahern
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Xin Long @ 2018-04-01 14:40 UTC (permalink / raw)
To: network dev; +Cc: davem, Julian Anastasov, David Ahern
Prior to this patch, when one packet is hashed into path [1]
(hash <= nh_upper_bound) and it's neigh is dead, it will try
path [2]. However, if path [2]'s neigh is alive but it's
hash > nh_upper_bound, it will not return this alive path.
This packet will never be sent even if path [2] is alive.
3.3.3.1/24:
nexthop via 1.1.1.254 dev eth1 weight 1 <--[1] (dead neigh)
nexthop via 2.2.2.254 dev eth2 weight 1 <--[2]
With sysctl_fib_multipath_use_neigh set is supposed to find an
available path respecting to the l3/l4 hash. But if there is
no available route with this hash, it should at least return
an alive route even with other hash.
This patch is to fix it by processing fib_multipath_use_neigh
earlier than the hash check, so that it will at least return
an alive route if there is when fib_multipath_use_neigh is
enabled. It's also compatible with before when there are alive
routes with the l3/l4 hash.
Fixes: a6db4494d218 ("net: ipv4: Consider failed nexthops in multipath routes")
Reported-by: Jianlin Shi <jishi@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
net/ipv4/fib_semantics.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 7d36a95..9d51292 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -1746,18 +1746,20 @@ void fib_select_multipath(struct fib_result *res, int hash)
bool first = false;
for_nexthops(fi) {
+ if (net->ipv4.sysctl_fib_multipath_use_neigh) {
+ if (!fib_good_nh(nh))
+ continue;
+ if (!first) {
+ res->nh_sel = nhsel;
+ first = true;
+ }
+ }
+
if (hash > atomic_read(&nh->nh_upper_bound))
continue;
- if (!net->ipv4.sysctl_fib_multipath_use_neigh ||
- fib_good_nh(nh)) {
- res->nh_sel = nhsel;
- return;
- }
- if (!first) {
- res->nh_sel = nhsel;
- first = true;
- }
+ res->nh_sel = nhsel;
+ return;
} endfor_nexthops(fi);
}
#endif
--
2.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net] route: check sysctl_fib_multipath_use_neigh earlier than hash
2018-04-01 14:40 [PATCH net] route: check sysctl_fib_multipath_use_neigh earlier than hash Xin Long
@ 2018-04-01 16:19 ` David Ahern
2018-04-02 0:58 ` David Miller
2018-04-05 1:33 ` Sasha Levin
2 siblings, 0 replies; 4+ messages in thread
From: David Ahern @ 2018-04-01 16:19 UTC (permalink / raw)
To: Xin Long, network dev; +Cc: davem, Julian Anastasov
On 4/1/18 8:40 AM, Xin Long wrote:
> Prior to this patch, when one packet is hashed into path [1]
> (hash <= nh_upper_bound) and it's neigh is dead, it will try
> path [2]. However, if path [2]'s neigh is alive but it's
> hash > nh_upper_bound, it will not return this alive path.
> This packet will never be sent even if path [2] is alive.
>
> 3.3.3.1/24:
> nexthop via 1.1.1.254 dev eth1 weight 1 <--[1] (dead neigh)
> nexthop via 2.2.2.254 dev eth2 weight 1 <--[2]
>
> With sysctl_fib_multipath_use_neigh set is supposed to find an
> available path respecting to the l3/l4 hash. But if there is
> no available route with this hash, it should at least return
> an alive route even with other hash.
>
> This patch is to fix it by processing fib_multipath_use_neigh
> earlier than the hash check, so that it will at least return
> an alive route if there is when fib_multipath_use_neigh is
> enabled. It's also compatible with before when there are alive
> routes with the l3/l4 hash.
>
> Fixes: a6db4494d218 ("net: ipv4: Consider failed nexthops in multipath routes")
> Reported-by: Jianlin Shi <jishi@redhat.com>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---
> net/ipv4/fib_semantics.c | 20 +++++++++++---------
> 1 file changed, 11 insertions(+), 9 deletions(-)
>
Acked-by: David Ahern <dsa@cumulusnetworks.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net] route: check sysctl_fib_multipath_use_neigh earlier than hash
2018-04-01 14:40 [PATCH net] route: check sysctl_fib_multipath_use_neigh earlier than hash Xin Long
2018-04-01 16:19 ` David Ahern
@ 2018-04-02 0:58 ` David Miller
2018-04-05 1:33 ` Sasha Levin
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-04-02 0:58 UTC (permalink / raw)
To: lucien.xin; +Cc: netdev, ja, dsa
From: Xin Long <lucien.xin@gmail.com>
Date: Sun, 1 Apr 2018 22:40:35 +0800
> Prior to this patch, when one packet is hashed into path [1]
> (hash <= nh_upper_bound) and it's neigh is dead, it will try
> path [2]. However, if path [2]'s neigh is alive but it's
> hash > nh_upper_bound, it will not return this alive path.
> This packet will never be sent even if path [2] is alive.
>
> 3.3.3.1/24:
> nexthop via 1.1.1.254 dev eth1 weight 1 <--[1] (dead neigh)
> nexthop via 2.2.2.254 dev eth2 weight 1 <--[2]
>
> With sysctl_fib_multipath_use_neigh set is supposed to find an
> available path respecting to the l3/l4 hash. But if there is
> no available route with this hash, it should at least return
> an alive route even with other hash.
>
> This patch is to fix it by processing fib_multipath_use_neigh
> earlier than the hash check, so that it will at least return
> an alive route if there is when fib_multipath_use_neigh is
> enabled. It's also compatible with before when there are alive
> routes with the l3/l4 hash.
>
> Fixes: a6db4494d218 ("net: ipv4: Consider failed nexthops in multipath routes")
> Reported-by: Jianlin Shi <jishi@redhat.com>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net] route: check sysctl_fib_multipath_use_neigh earlier than hash
2018-04-01 14:40 [PATCH net] route: check sysctl_fib_multipath_use_neigh earlier than hash Xin Long
2018-04-01 16:19 ` David Ahern
2018-04-02 0:58 ` David Miller
@ 2018-04-05 1:33 ` Sasha Levin
2 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2018-04-05 1:33 UTC (permalink / raw)
To: Sasha Levin, Xin Long, network dev
Cc: davem@davemloft.net, Julian Anastasov, stable@vger.kernel.org
Hi Xin Long.
[This is an automated email]
This commit has been processed because it contains a "Fixes:" tag.
fixing commit: a6db4494d218 net: ipv4: Consider failed nexthops in multipath routes.
The bot has also determined it's probably a bug fixing patch. (score: 58.0140)
The bot has tested the following trees: v4.15.15, v4.14.32, v4.9.92,
v4.15.15: Build OK!
v4.14.32: Build OK!
v4.9.92: Build OK!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-04-05 1:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-01 14:40 [PATCH net] route: check sysctl_fib_multipath_use_neigh earlier than hash Xin Long
2018-04-01 16:19 ` David Ahern
2018-04-02 0:58 ` David Miller
2018-04-05 1:33 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox