ip: rework the fix for dflt addr selection for connected nexthop"
Subsystems (3)
cover ip: rework the fix for dflt addr selection for connected nexthop"
This series reworks the fix that is reverted in the second commit. As Julian explained, nhc_scope is related to nhc_gw, it's not the scope of the route.
net/ipv4/fib_frontend.c | 4 ++-- net/ipv4/fib_semantics.c | 2 +- net/ipv4/nexthop.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
Comments are welcome.
Regards,
Nicolas
PATCH 1/3 Revert "ip: fix triggering of 'icmp redirect'"
This reverts commit eb55dc09b5dd040232d5de32812cc83001a23da6.
The patch that introduces this bug is reverted right after this one.
--- net/ipv4/fib_frontend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/fib_frontend.c +2 -2
@@ -389,7 +389,7 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, dev_match = dev_match || (res.type ==RTN_LOCAL && dev == net->loopback_dev);if (dev_match) { - ret =FIB_RES_NHC (res)->nhc_scope >=RT_SCOPE_LINK ; + ret =FIB_RES_NHC (res)->nhc_scope >=RT_SCOPE_HOST ;return ret; }if (no_addr)
@@ -401,7 +401,7 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, ret =0 ;if (fib_lookup (net, &fl4, &res,FIB_LOOKUP_IGNORE_LINKSTATE ) ==0 ) {if (res.type ==RTN_UNICAST ) - ret =FIB_RES_NHC (res)->nhc_scope >=RT_SCOPE_LINK ; + ret =FIB_RES_NHC (res)->nhc_scope >=RT_SCOPE_HOST ; }return ret;
Signature · 1 line
2.37.3
PATCH 2/3 Revert "ip: fix dflt addr selection for connected nexthop"
In reply to Nicolas DichtelThis reverts commit 747c14307214b55dbd8250e1ab44cad8305756f1.
As explained by Julian, nhc_scope is related to nhc_gw, not to the route. Revert the original patch. The initial problem is fixed differently in the next commit.
--- net/ipv4/fib_semantics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/fib_semantics.c +1 -1
@@ -1231,7 +1231,7 @@ static int fib_check_nh_nongw(struct net *net, struct fib_nh *nh, nh->fib_nh_dev = in_dev->dev;netdev_hold (nh->fib_nh_dev, &nh->fib_nh_dev_tracker,GFP_ATOMIC ); - nh->fib_nh_scope =RT_SCOPE_LINK ; + nh->fib_nh_scope =RT_SCOPE_HOST ;if (!netif_carrier_ok (nh->fib_nh_dev)) nh->fib_nh_flags |=RTNH_F_LINKDOWN ; err =0 ;
Signature · 1 line
2.37.3
PATCH 3/3 nh: fix scope used to find saddr when adding non gw nh
In reply to Nicolas DichtelAs explained by Julian, fib_nh_scope is related to fib_nh_gw4, but fib_info_update_nhc_saddr() needs the scope of the route, which is the scope "before" fib_nh_scope, ie fib_nh_scope - 1.
This patch fixes the problem described in commit 747c14307214 ("ip: fix dflt addr selection for connected nexthop").
--- net/ipv4/nexthop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/nexthop.c +1 -1
@@ -2534,7 +2534,7 @@ static int nh_create_ipv4(struct net *net, struct nexthop *nh,if (!err) { nh->nh_flags = fib_nh->fib_nh_flags;fib_info_update_nhc_saddr (net, &fib_nh->nh_common, - fib_nh->fib_nh_scope); + !fib_nh->fib_nh_scope ?0 : fib_nh->fib_nh_scope -1 ); }else {fib_nh_release (net, fib_nh); }
Signature · 1 line
2.37.3
Hello,
Quoted 10 lines · Nicolas Dichtel
This series reworks the fix that is reverted in the second commit. As Julian explained,
nhc_scopeis related tonhc_gw, it's not the scope of the route.net/ipv4/fib_frontend.c | 4 ++-- net/ipv4/fib_semantics.c | 2 +- net/ipv4/nexthop.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)Comments are welcome.
Patchset looks good to me, thanks!
Regards
--
Julian Anastasov <[email protected]>
This series was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Thu, 20 Oct 2022 12:09:49 +0200 you wrote:
This series reworks the fix that is reverted in the second commit. As Julian explained,
nhc_scopeis related tonhc_gw, it's not the scope of the route.net/ipv4/fib_frontend.c | 4 ++-- net/ipv4/fib_semantics.c | 2 +- net/ipv4/nexthop.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)[...]
Here is the summary with links:
- [net,1/3] Revert "ip: fix triggering of 'icmp redirect'"
https://git.kernel.org/netdev/net/c/745b913a5994 - [net,2/3] Revert "ip: fix dflt addr selection for connected nexthop" https://git.kernel.org/netdev/net/c/e021c329ee19 - [net,3/3] nh: fix scope used to find saddr when adding non gw nh https://git.kernel.org/netdev/net/c/bac0f937c343
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html