[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5d12353d-8c1b-4dcb-a908-5ccb8081970b@kernel.org>
Date: Sun, 11 Feb 2024 12:03:19 -0700
From: David Ahern <dsahern@...nel.org>
To: Guillaume Nault <gnault@...hat.com>, David Miller <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Eric Dumazet <edumazet@...gle.com>
Cc: netdev@...r.kernel.org, James Chapman <jchapman@...alix.com>,
Taehee Yoo <ap420073@...il.com>
Subject: Re: [PATCH net-next] ipv4: Set the routing scope properly in
ip_route_output_ports().
On 2/9/24 9:43 AM, Guillaume Nault wrote:
> Set scope automatically in ip_route_output_ports() (using the socket
> SOCK_LOCALROUTE flag). This way, callers don't have to overload the
> tos with the RTO_ONLINK flag, like RT_CONN_FLAGS() does.
>
> For callers that don't pass a struct sock, this doesn't change anything
> as the scope is still set to RT_SCOPE_UNIVERSE when sk is NULL.
>
> Callers that passed a struct sock and used RT_CONN_FLAGS(sk) or
> RT_CONN_FLAGS_TOS(sk, tos) for the tos are modified to use
> ip_sock_tos(sk) and RT_TOS(tos) respectively, as overloading tos with
> the RTO_ONLINK flag now becomes unnecessary.
>
> In drivers/net/amt.c, all ip_route_output_ports() calls use a 0 tos
> parameter, ignoring the SOCK_LOCALROUTE flag of the socket. But the sk
> parameter is a kernel socket, which doesn't have any configuration path
> for setting SOCK_LOCALROUTE anyway. Therefore, ip_route_output_ports()
> will continue to initialise scope with RT_SCOPE_UNIVERSE and amt.c
> doesn't need to be modified.
>
> Also, remove RT_CONN_FLAGS() and RT_CONN_FLAGS_TOS() from route.h as
> these macros are now unused.
>
> The objective is to eventually remove RTO_ONLINK entirely to allow
> converting ->flowi4_tos to dscp_t. This will ensure proper isolation
> between the DSCP and ECN bits, thus minimising the risk of introducing
> bugs where TOS values interfere with ECN.
>
> Signed-off-by: Guillaume Nault <gnault@...hat.com>
> ---
> include/net/route.h | 7 ++-----
> net/ipv4/af_inet.c | 2 +-
> net/ipv4/datagram.c | 2 +-
> net/ipv4/inet_connection_sock.c | 2 +-
> net/ipv4/ip_output.c | 2 +-
> net/l2tp/l2tp_ip.c | 2 +-
> 6 files changed, 7 insertions(+), 10 deletions(-)
>
Reviewed-by: David Ahern <dsahern@...nel.org>
Powered by blists - more mailing lists