ipv4: Remove RT_CONN_FLAGS() calls in flowi4_init_output().
Subsystems (3)
cover ipv4: Remove RT_CONN_FLAGS() calls in flowi4_init_output().
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(-)
Signature · 1 line
2.39.2
PATCH 1/2 ipv4: Set correct scope in inet_csk_route_*().
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.
--- net/ipv4/inet_connection_sock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/inet_connection_sock.c +2 -2
@@ -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,
Signature · 1 line
2.39.2
Re: [PATCH net-next 1/2] ipv4: Set correct scope in inet_csk_route_*().
Quoted 4 lines · Guillaume Nault
RT_CONN_FLAGS(sk)overloads the tos parameter with theRTO_ONLINKbit when sk has theSOCK_LOCALROUTEflag set. This is only useful forip_route_output_key_hash()to eventually adjust the route scope.
Quoted 9 lines
Let's drop
RTO_ONLINKand set the correct scope directly to avoid this special case in the future and to allow converting ->flowi4_tos todscp_t.Signed-off-by Guillaume Nault <[email protected]>--- net/ipv4/inet_connection_sock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
PATCH 2/2 tcp: Set route scope properly in cookie_v4_check().
In reply to Guillaume NaultRT_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.
--- net/ipv4/syncookies.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/syncookies.c +2 -2
@@ -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));
Signature · 1 line
2.39.2
Re: [PATCH net-next 2/2] tcp: Set route scope properly in cookie_v4_check().
Quoted 9 lines · Guillaume Nault
RT_CONN_FLAGS(sk)overloadsflowi4_toswith theRTO_ONLINKbit when sk has theSOCK_LOCALROUTEflag set. This allowsip_route_output_key_hash()to eventually adjustflowi4_scope.Instead of relying on special handling of the
RTO_ONLINKbit, we can just set the route scope correctly. This will eventually allow to avoid special interpretation of tos variables and to convert ->flowi4_tos todscp_t.
Quoted 5 lines
Signed-off-by Guillaume Nault <[email protected]>--- net/ipv4/syncookies.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Mon, 5 Jun 2023 23:55:19 +0200 you wrote:
Remove a few
RT_CONN_FLAGS()calls used insideflowi4_init_output(). These users can be easily converted to set the scope properly, instead of overloading the tos parameter with scope information as done byRT_CONN_FLAGS().The objective is to eventually remove
RT_CONN_FLAGS()entirely, which will then allow to also removeRTO_ONLINKand to finally convert ->flowi4_tos todscp_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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html