mbox series

[net-next,00/12] Unmask upper DSCP bits - part 4 (last)

Message ID 20240905165140.3105140-1-idosch@nvidia.com (mailing list archive)
Headers show
Series Unmask upper DSCP bits - part 4 (last) | expand

Message

Ido Schimmel Sept. 5, 2024, 4:51 p.m. UTC
tl;dr - This patchset finishes to unmask the upper DSCP bits in the IPv4
flow key in preparation for allowing IPv4 FIB rules to match on DSCP. No
functional changes are expected.

The TOS field in the IPv4 flow key ('flowi4_tos') is used during FIB
lookup to match against the TOS selector in FIB rules and routes.

It is currently impossible for user space to configure FIB rules that
match on the DSCP value as the upper DSCP bits are either masked in the
various call sites that initialize the IPv4 flow key or along the path
to the FIB core.

In preparation for adding a DSCP selector to IPv4 and IPv6 FIB rules, we
need to make sure the entire DSCP value is present in the IPv4 flow key.
This patchset finishes to unmask the upper DSCP bits by adjusting all
the callers of ip_route_output_key() to properly initialize the full
DSCP value in the IPv4 flow key.

No functional changes are expected as commit 1fa3314c14c6 ("ipv4:
Centralize TOS matching") moved the masking of the upper DSCP bits to
the core where 'flowi4_tos' is matched against the TOS selector.

Ido Schimmel (12):
  netfilter: br_netfilter: Unmask upper DSCP bits in
    br_nf_pre_routing_finish()
  ipv4: ip_gre: Unmask upper DSCP bits in ipgre_open()
  bpf: lwtunnel: Unmask upper DSCP bits in bpf_lwt_xmit_reroute()
  ipv4: icmp: Unmask upper DSCP bits in icmp_reply()
  ipv4: ip_tunnel: Unmask upper DSCP bits in ip_tunnel_bind_dev()
  ipv4: ip_tunnel: Unmask upper DSCP bits in ip_md_tunnel_xmit()
  ipv4: ip_tunnel: Unmask upper DSCP bits in ip_tunnel_xmit()
  ipv4: netfilter: Unmask upper DSCP bits in ip_route_me_harder()
  netfilter: nft_flow_offload: Unmask upper DSCP bits in
    nft_flow_route()
  netfilter: nf_dup4: Unmask upper DSCP bits in nf_dup_ipv4_route()
  ipv4: udp_tunnel: Unmask upper DSCP bits in udp_tunnel_dst_lookup()
  sctp: Unmask upper DSCP bits in sctp_v4_get_dst()

 net/bridge/br_netfilter_hooks.c  |  3 ++-
 net/core/lwt_bpf.c               |  3 ++-
 net/ipv4/icmp.c                  |  2 +-
 net/ipv4/ip_gre.c                |  3 ++-
 net/ipv4/ip_tunnel.c             | 11 ++++++-----
 net/ipv4/netfilter.c             |  3 ++-
 net/ipv4/netfilter/nf_dup_ipv4.c |  3 ++-
 net/ipv4/udp_tunnel_core.c       |  3 ++-
 net/netfilter/nft_flow_offload.c |  3 ++-
 net/sctp/protocol.c              |  3 ++-
 10 files changed, 23 insertions(+), 14 deletions(-)

Comments

David Ahern Sept. 6, 2024, 5:13 p.m. UTC | #1
On 9/5/24 10:51 AM, Ido Schimmel wrote:
> tl;dr - This patchset finishes to unmask the upper DSCP bits in the IPv4
> flow key in preparation for allowing IPv4 FIB rules to match on DSCP. No
> functional changes are expected.
> 
> The TOS field in the IPv4 flow key ('flowi4_tos') is used during FIB
> lookup to match against the TOS selector in FIB rules and routes.
> 
> It is currently impossible for user space to configure FIB rules that
> match on the DSCP value as the upper DSCP bits are either masked in the
> various call sites that initialize the IPv4 flow key or along the path
> to the FIB core.
> 
> In preparation for adding a DSCP selector to IPv4 and IPv6 FIB rules, we
> need to make sure the entire DSCP value is present in the IPv4 flow key.
> This patchset finishes to unmask the upper DSCP bits by adjusting all
> the callers of ip_route_output_key() to properly initialize the full
> DSCP value in the IPv4 flow key.
> 
> No functional changes are expected as commit 1fa3314c14c6 ("ipv4:
> Centralize TOS matching") moved the masking of the upper DSCP bits to
> the core where 'flowi4_tos' is matched against the TOS selector.
> 
> Ido Schimmel (12):
>   netfilter: br_netfilter: Unmask upper DSCP bits in
>     br_nf_pre_routing_finish()
>   ipv4: ip_gre: Unmask upper DSCP bits in ipgre_open()
>   bpf: lwtunnel: Unmask upper DSCP bits in bpf_lwt_xmit_reroute()
>   ipv4: icmp: Unmask upper DSCP bits in icmp_reply()
>   ipv4: ip_tunnel: Unmask upper DSCP bits in ip_tunnel_bind_dev()
>   ipv4: ip_tunnel: Unmask upper DSCP bits in ip_md_tunnel_xmit()
>   ipv4: ip_tunnel: Unmask upper DSCP bits in ip_tunnel_xmit()
>   ipv4: netfilter: Unmask upper DSCP bits in ip_route_me_harder()
>   netfilter: nft_flow_offload: Unmask upper DSCP bits in
>     nft_flow_route()
>   netfilter: nf_dup4: Unmask upper DSCP bits in nf_dup_ipv4_route()
>   ipv4: udp_tunnel: Unmask upper DSCP bits in udp_tunnel_dst_lookup()
>   sctp: Unmask upper DSCP bits in sctp_v4_get_dst()
> 
>  net/bridge/br_netfilter_hooks.c  |  3 ++-
>  net/core/lwt_bpf.c               |  3 ++-
>  net/ipv4/icmp.c                  |  2 +-
>  net/ipv4/ip_gre.c                |  3 ++-
>  net/ipv4/ip_tunnel.c             | 11 ++++++-----
>  net/ipv4/netfilter.c             |  3 ++-
>  net/ipv4/netfilter/nf_dup_ipv4.c |  3 ++-
>  net/ipv4/udp_tunnel_core.c       |  3 ++-
>  net/netfilter/nft_flow_offload.c |  3 ++-
>  net/sctp/protocol.c              |  3 ++-
>  10 files changed, 23 insertions(+), 14 deletions(-)
> 

For the set:
Reviewed-by: David Ahern <dsahern@kernel.org>
patchwork-bot+netdevbpf@kernel.org Sept. 9, 2024, 1:20 p.m. UTC | #2
Hello:

This series was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Thu, 5 Sep 2024 19:51:28 +0300 you wrote:
> tl;dr - This patchset finishes to unmask the upper DSCP bits in the IPv4
> flow key in preparation for allowing IPv4 FIB rules to match on DSCP. No
> functional changes are expected.
> 
> The TOS field in the IPv4 flow key ('flowi4_tos') is used during FIB
> lookup to match against the TOS selector in FIB rules and routes.
> 
> [...]

Here is the summary with links:
  - [net-next,01/12] netfilter: br_netfilter: Unmask upper DSCP bits in br_nf_pre_routing_finish()
    https://git.kernel.org/netdev/net-next/c/1f23a1909d7f
  - [net-next,02/12] ipv4: ip_gre: Unmask upper DSCP bits in ipgre_open()
    https://git.kernel.org/netdev/net-next/c/25376a890119
  - [net-next,03/12] bpf: lwtunnel: Unmask upper DSCP bits in bpf_lwt_xmit_reroute()
    https://git.kernel.org/netdev/net-next/c/b3899830aa47
  - [net-next,04/12] ipv4: icmp: Unmask upper DSCP bits in icmp_reply()
    https://git.kernel.org/netdev/net-next/c/848789d552bb
  - [net-next,05/12] ipv4: ip_tunnel: Unmask upper DSCP bits in ip_tunnel_bind_dev()
    https://git.kernel.org/netdev/net-next/c/e7191e517a03
  - [net-next,06/12] ipv4: ip_tunnel: Unmask upper DSCP bits in ip_md_tunnel_xmit()
    https://git.kernel.org/netdev/net-next/c/c34cfe72bb26
  - [net-next,07/12] ipv4: ip_tunnel: Unmask upper DSCP bits in ip_tunnel_xmit()
    https://git.kernel.org/netdev/net-next/c/c2b639f9f3b7
  - [net-next,08/12] ipv4: netfilter: Unmask upper DSCP bits in ip_route_me_harder()
    https://git.kernel.org/netdev/net-next/c/4f0880766a97
  - [net-next,09/12] netfilter: nft_flow_offload: Unmask upper DSCP bits in nft_flow_route()
    https://git.kernel.org/netdev/net-next/c/b7172768abfd
  - [net-next,10/12] netfilter: nf_dup4: Unmask upper DSCP bits in nf_dup_ipv4_route()
    https://git.kernel.org/netdev/net-next/c/345663e6a727
  - [net-next,11/12] ipv4: udp_tunnel: Unmask upper DSCP bits in udp_tunnel_dst_lookup()
    https://git.kernel.org/netdev/net-next/c/2c60fc9ca216
  - [net-next,12/12] sctp: Unmask upper DSCP bits in sctp_v4_get_dst()
    https://git.kernel.org/netdev/net-next/c/8b6d13cc8b38

You are awesome, thank you!