All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] ipv4: Remove RT_CONN_FLAGS() calls in flowi4_init_output().
@ 2023-06-05 21:55 Guillaume Nault
  2023-06-05 21:55 ` [PATCH net-next 1/2] ipv4: Set correct scope in inet_csk_route_*() Guillaume Nault
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Guillaume Nault @ 2023-06-05 21:55 UTC (permalink / raw)
  To: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: netdev, David Ahern

Remove a few RT_CONN_FLAGS() calls used inside flowi4_init_output().
These users can be easily converted to set the scope properly, instead
of overloading the tos parameter with scope information as done by
RT_CONN_FLAGS().

The objective is to eventually remove RT_CONN_FLAGS() entirely, which
will then allow to also remove RTO_ONLINK and to finally convert
->flowi4_tos to dscp_t.

Guillaume Nault (2):
  ipv4: Set correct scope in inet_csk_route_*().
  tcp: Set route scope properly in cookie_v4_check().

 net/ipv4/inet_connection_sock.c | 4 ++--
 net/ipv4/syncookies.c           | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.39.2


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

* [PATCH net-next 1/2] ipv4: Set correct scope in inet_csk_route_*().
  2023-06-05 21:55 [PATCH net-next 0/2] ipv4: Remove RT_CONN_FLAGS() calls in flowi4_init_output() Guillaume Nault
@ 2023-06-05 21:55 ` Guillaume Nault
  2023-06-06  2:47   ` David Ahern
  2023-06-05 21:55 ` [PATCH net-next 2/2] tcp: Set route scope properly in cookie_v4_check() Guillaume Nault
  2023-06-07  4:20 ` [PATCH net-next 0/2] ipv4: Remove RT_CONN_FLAGS() calls in flowi4_init_output() patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Guillaume Nault @ 2023-06-05 21:55 UTC (permalink / raw)
  To: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: netdev, David Ahern

RT_CONN_FLAGS(sk) overloads the tos parameter with the RTO_ONLINK bit
when sk has the SOCK_LOCALROUTE flag set. This is only useful for
ip_route_output_key_hash() to eventually adjust the route scope.

Let's drop RTO_ONLINK and set the correct scope directly to avoid this
special case in the future and to allow converting ->flowi4_tos to
dscp_t.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
---
 net/ipv4/inet_connection_sock.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 1386787eaf1a..15424dec4584 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -792,7 +792,7 @@ struct dst_entry *inet_csk_route_req(const struct sock *sk,
 	opt = rcu_dereference(ireq->ireq_opt);
 
 	flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark,
-			   RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE,
+			   ip_sock_rt_tos(sk), ip_sock_rt_scope(sk),
 			   sk->sk_protocol, inet_sk_flowi_flags(sk),
 			   (opt && opt->opt.srr) ? opt->opt.faddr : ireq->ir_rmt_addr,
 			   ireq->ir_loc_addr, ireq->ir_rmt_port,
@@ -830,7 +830,7 @@ struct dst_entry *inet_csk_route_child_sock(const struct sock *sk,
 	fl4 = &newinet->cork.fl.u.ip4;
 
 	flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark,
-			   RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE,
+			   ip_sock_rt_tos(sk), ip_sock_rt_scope(sk),
 			   sk->sk_protocol, inet_sk_flowi_flags(sk),
 			   (opt && opt->opt.srr) ? opt->opt.faddr : ireq->ir_rmt_addr,
 			   ireq->ir_loc_addr, ireq->ir_rmt_port,
-- 
2.39.2


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

* [PATCH net-next 2/2] tcp: Set route scope properly in cookie_v4_check().
  2023-06-05 21:55 [PATCH net-next 0/2] ipv4: Remove RT_CONN_FLAGS() calls in flowi4_init_output() Guillaume Nault
  2023-06-05 21:55 ` [PATCH net-next 1/2] ipv4: Set correct scope in inet_csk_route_*() Guillaume Nault
@ 2023-06-05 21:55 ` Guillaume Nault
  2023-06-06  2:47   ` David Ahern
  2023-06-07  4:20 ` [PATCH net-next 0/2] ipv4: Remove RT_CONN_FLAGS() calls in flowi4_init_output() patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Guillaume Nault @ 2023-06-05 21:55 UTC (permalink / raw)
  To: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: netdev, David Ahern

RT_CONN_FLAGS(sk) overloads flowi4_tos with the RTO_ONLINK bit when
sk has the SOCK_LOCALROUTE flag set. This allows
ip_route_output_key_hash() to eventually adjust flowi4_scope.

Instead of relying on special handling of the RTO_ONLINK bit, we can
just set the route scope correctly. This will eventually allow to avoid
special interpretation of tos variables and to convert ->flowi4_tos to
dscp_t.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
---
 net/ipv4/syncookies.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index 26fb97d1d4d9..dc478a0574cb 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -418,8 +418,8 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
 	 * no easy way to do this.
 	 */
 	flowi4_init_output(&fl4, ireq->ir_iif, ireq->ir_mark,
-			   RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, IPPROTO_TCP,
-			   inet_sk_flowi_flags(sk),
+			   ip_sock_rt_tos(sk), ip_sock_rt_scope(sk),
+			   IPPROTO_TCP, inet_sk_flowi_flags(sk),
 			   opt->srr ? opt->faddr : ireq->ir_rmt_addr,
 			   ireq->ir_loc_addr, th->source, th->dest, sk->sk_uid);
 	security_req_classify_flow(req, flowi4_to_flowi_common(&fl4));
-- 
2.39.2


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

* Re: [PATCH net-next 1/2] ipv4: Set correct scope in inet_csk_route_*().
  2023-06-05 21:55 ` [PATCH net-next 1/2] ipv4: Set correct scope in inet_csk_route_*() Guillaume Nault
@ 2023-06-06  2:47   ` David Ahern
  0 siblings, 0 replies; 6+ messages in thread
From: David Ahern @ 2023-06-06  2:47 UTC (permalink / raw)
  To: Guillaume Nault, David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: netdev

On 6/5/23 3:55 PM, Guillaume Nault wrote:
> RT_CONN_FLAGS(sk) overloads the tos parameter with the RTO_ONLINK bit
> when sk has the SOCK_LOCALROUTE flag set. This is only useful for
> ip_route_output_key_hash() to eventually adjust the route scope.
> 
> Let's drop RTO_ONLINK and set the correct scope directly to avoid this
> special case in the future and to allow converting ->flowi4_tos to
> dscp_t.
> 
> Signed-off-by: Guillaume Nault <gnault@redhat.com>
> ---
>  net/ipv4/inet_connection_sock.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>



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

* Re: [PATCH net-next 2/2] tcp: Set route scope properly in cookie_v4_check().
  2023-06-05 21:55 ` [PATCH net-next 2/2] tcp: Set route scope properly in cookie_v4_check() Guillaume Nault
@ 2023-06-06  2:47   ` David Ahern
  0 siblings, 0 replies; 6+ messages in thread
From: David Ahern @ 2023-06-06  2:47 UTC (permalink / raw)
  To: Guillaume Nault, David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: netdev

On 6/5/23 3:55 PM, Guillaume Nault wrote:
> RT_CONN_FLAGS(sk) overloads flowi4_tos with the RTO_ONLINK bit when
> sk has the SOCK_LOCALROUTE flag set. This allows
> ip_route_output_key_hash() to eventually adjust flowi4_scope.
> 
> Instead of relying on special handling of the RTO_ONLINK bit, we can
> just set the route scope correctly. This will eventually allow to avoid
> special interpretation of tos variables and to convert ->flowi4_tos to
> dscp_t.
> 
> Signed-off-by: Guillaume Nault <gnault@redhat.com>
> ---
>  net/ipv4/syncookies.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>



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

* Re: [PATCH net-next 0/2] ipv4: Remove RT_CONN_FLAGS() calls in flowi4_init_output().
  2023-06-05 21:55 [PATCH net-next 0/2] ipv4: Remove RT_CONN_FLAGS() calls in flowi4_init_output() Guillaume Nault
  2023-06-05 21:55 ` [PATCH net-next 1/2] ipv4: Set correct scope in inet_csk_route_*() Guillaume Nault
  2023-06-05 21:55 ` [PATCH net-next 2/2] tcp: Set route scope properly in cookie_v4_check() Guillaume Nault
@ 2023-06-07  4:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-06-07  4:20 UTC (permalink / raw)
  To: Guillaume Nault; +Cc: davem, kuba, pabeni, edumazet, netdev, dsahern

Hello:

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

On Mon, 5 Jun 2023 23:55:19 +0200 you wrote:
> Remove a few RT_CONN_FLAGS() calls used inside flowi4_init_output().
> These users can be easily converted to set the scope properly, instead
> of overloading the tos parameter with scope information as done by
> RT_CONN_FLAGS().
> 
> The objective is to eventually remove RT_CONN_FLAGS() entirely, which
> will then allow to also remove RTO_ONLINK and to finally convert
> ->flowi4_tos to dscp_t.
> 
> [...]

Here is the summary with links:
  - [net-next,1/2] ipv4: Set correct scope in inet_csk_route_*().
    https://git.kernel.org/netdev/net-next/c/4b095281caca
  - [net-next,2/2] tcp: Set route scope properly in cookie_v4_check().
    https://git.kernel.org/netdev/net-next/c/6f8a76f80221

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:[~2023-06-07  4:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-05 21:55 [PATCH net-next 0/2] ipv4: Remove RT_CONN_FLAGS() calls in flowi4_init_output() Guillaume Nault
2023-06-05 21:55 ` [PATCH net-next 1/2] ipv4: Set correct scope in inet_csk_route_*() Guillaume Nault
2023-06-06  2:47   ` David Ahern
2023-06-05 21:55 ` [PATCH net-next 2/2] tcp: Set route scope properly in cookie_v4_check() Guillaume Nault
2023-06-06  2:47   ` David Ahern
2023-06-07  4:20 ` [PATCH net-next 0/2] ipv4: Remove RT_CONN_FLAGS() calls in flowi4_init_output() 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.