All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/3] ip: rework the fix for dflt addr selection for connected nexthop"
@ 2022-10-20 10:09 Nicolas Dichtel
  2022-10-20 10:09 ` [PATCH net 1/3] Revert "ip: fix triggering of 'icmp redirect'" Nicolas Dichtel
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Nicolas Dichtel @ 2022-10-20 10:09 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: Julian Anastasov, David Ahern, netdev

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net 1/3] Revert "ip: fix triggering of 'icmp redirect'"
  2022-10-20 10:09 [PATCH net 0/3] ip: rework the fix for dflt addr selection for connected nexthop" Nicolas Dichtel
@ 2022-10-20 10:09 ` Nicolas Dichtel
  2022-10-20 10:09 ` [PATCH net 2/3] Revert "ip: fix dflt addr selection for connected nexthop" Nicolas Dichtel
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Nicolas Dichtel @ 2022-10-20 10:09 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: Julian Anastasov, David Ahern, netdev, Nicolas Dichtel

This reverts commit eb55dc09b5dd040232d5de32812cc83001a23da6.

The patch that introduces this bug is reverted right after this one.

CC: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 net/ipv4/fib_frontend.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 943edf4ad4db..f361d3d56be2 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -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;
 
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net 2/3] Revert "ip: fix dflt addr selection for connected nexthop"
  2022-10-20 10:09 [PATCH net 0/3] ip: rework the fix for dflt addr selection for connected nexthop" Nicolas Dichtel
  2022-10-20 10:09 ` [PATCH net 1/3] Revert "ip: fix triggering of 'icmp redirect'" Nicolas Dichtel
@ 2022-10-20 10:09 ` Nicolas Dichtel
  2022-10-20 10:09 ` [PATCH net 3/3] nh: fix scope used to find saddr when adding non gw nh Nicolas Dichtel
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Nicolas Dichtel @ 2022-10-20 10:09 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: Julian Anastasov, David Ahern, netdev, Nicolas Dichtel

This 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.

Link: https://lore.kernel.org/netdev/6c8a44ba-c2d5-cdf-c5c7-5baf97cba38@ssi.bg/
CC: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 net/ipv4/fib_semantics.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index e9a7f70a54df..f721c308248b 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -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;
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net 3/3] nh: fix scope used to find saddr when adding non gw nh
  2022-10-20 10:09 [PATCH net 0/3] ip: rework the fix for dflt addr selection for connected nexthop" Nicolas Dichtel
  2022-10-20 10:09 ` [PATCH net 1/3] Revert "ip: fix triggering of 'icmp redirect'" Nicolas Dichtel
  2022-10-20 10:09 ` [PATCH net 2/3] Revert "ip: fix dflt addr selection for connected nexthop" Nicolas Dichtel
@ 2022-10-20 10:09 ` Nicolas Dichtel
  2022-10-20 10:59 ` [PATCH net 0/3] ip: rework the fix for dflt addr selection for connected nexthop" Julian Anastasov
  2022-10-27 17:40 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Nicolas Dichtel @ 2022-10-20 10:09 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: Julian Anastasov, David Ahern, netdev, Nicolas Dichtel

As 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").

Fixes: 597cfe4fc339 ("nexthop: Add support for IPv4 nexthops")
Link: https://lore.kernel.org/netdev/6c8a44ba-c2d5-cdf-c5c7-5baf97cba38@ssi.bg/
CC: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 net/ipv4/nexthop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
index 853a75a8fbaf..d8ef05347fd9 100644
--- a/net/ipv4/nexthop.c
+++ b/net/ipv4/nexthop.c
@@ -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);
 	}
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net 0/3] ip: rework the fix for dflt addr selection for connected nexthop"
  2022-10-20 10:09 [PATCH net 0/3] ip: rework the fix for dflt addr selection for connected nexthop" Nicolas Dichtel
                   ` (2 preceding siblings ...)
  2022-10-20 10:09 ` [PATCH net 3/3] nh: fix scope used to find saddr when adding non gw nh Nicolas Dichtel
@ 2022-10-20 10:59 ` Julian Anastasov
  2022-10-27 17:40 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Julian Anastasov @ 2022-10-20 10:59 UTC (permalink / raw)
  To: Nicolas Dichtel
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
	David Ahern, netdev


	Hello,

On Thu, 20 Oct 2022, Nicolas Dichtel wrote:

> 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.

	Patchset looks good to me, thanks!

Reviewed-by: Julian Anastasov <ja@ssi.bg>

Regards

--
Julian Anastasov <ja@ssi.bg>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net 0/3] ip: rework the fix for dflt addr selection for connected nexthop"
  2022-10-20 10:09 [PATCH net 0/3] ip: rework the fix for dflt addr selection for connected nexthop" Nicolas Dichtel
                   ` (3 preceding siblings ...)
  2022-10-20 10:59 ` [PATCH net 0/3] ip: rework the fix for dflt addr selection for connected nexthop" Julian Anastasov
@ 2022-10-27 17:40 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-10-27 17:40 UTC (permalink / raw)
  To: Nicolas Dichtel; +Cc: davem, kuba, pabeni, edumazet, ja, dsahern, netdev

Hello:

This series was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

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_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(-)
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-10-27 17:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-20 10:09 [PATCH net 0/3] ip: rework the fix for dflt addr selection for connected nexthop" Nicolas Dichtel
2022-10-20 10:09 ` [PATCH net 1/3] Revert "ip: fix triggering of 'icmp redirect'" Nicolas Dichtel
2022-10-20 10:09 ` [PATCH net 2/3] Revert "ip: fix dflt addr selection for connected nexthop" Nicolas Dichtel
2022-10-20 10:09 ` [PATCH net 3/3] nh: fix scope used to find saddr when adding non gw nh Nicolas Dichtel
2022-10-20 10:59 ` [PATCH net 0/3] ip: rework the fix for dflt addr selection for connected nexthop" Julian Anastasov
2022-10-27 17:40 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.