mbox series

[net-next,00/12] Unmask upper DSCP bits - part 1

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

Message

Ido Schimmel Aug. 21, 2024, 12:52 p.m. UTC
tl;dr - This patchset starts 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 starts to unmask the upper DSCP bits in the various places
that invoke the core FIB lookup functions directly (patches #1-#7) and
in the input route path (patches #8-#12). Future patchsets will do the
same in the output route path.

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):
  bpf: Unmask upper DSCP bits in bpf_fib_lookup() helper
  ipv4: Unmask upper DSCP bits in NETLINK_FIB_LOOKUP family
  ipv4: Unmask upper DSCP bits when constructing the Record Route option
  netfilter: rpfilter: Unmask upper DSCP bits
  netfilter: nft_fib: Unmask upper DSCP bits
  ipv4: ipmr: Unmask upper DSCP bits in ipmr_rt_fib_lookup()
  ipv4: Unmask upper DSCP bits in fib_compute_spec_dst()
  ipv4: Unmask upper DSCP bits in input route lookup
  ipv4: Unmask upper DSCP bits in RTM_GETROUTE input route lookup
  ipv4: icmp: Pass full DS field to ip_route_input()
  ipv4: udp: Unmask upper DSCP bits during early demux
  ipv4: Unmask upper DSCP bits when using hints

 net/core/filter.c                 | 3 ++-
 net/ipv4/fib_frontend.c           | 4 ++--
 net/ipv4/icmp.c                   | 2 +-
 net/ipv4/ipmr.c                   | 3 ++-
 net/ipv4/netfilter/ipt_rpfilter.c | 3 ++-
 net/ipv4/netfilter/nft_fib_ipv4.c | 3 ++-
 net/ipv4/route.c                  | 8 ++++----
 net/ipv4/udp.c                    | 3 ++-
 8 files changed, 17 insertions(+), 12 deletions(-)

Comments

Florian Westphal Aug. 21, 2024, 2:48 p.m. UTC | #1
Ido Schimmel <idosch@nvidia.com> wrote:
> tl;dr - This patchset starts 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.

Thanks Ido.

For netfilter bits:
Acked-by: Florian Westphal <fw@strlen.de>
David Ahern Aug. 21, 2024, 5 p.m. UTC | #2
On 8/21/24 6:52 AM, Ido Schimmel wrote:
> tl;dr - This patchset starts 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 starts to unmask the upper DSCP bits in the various places
> that invoke the core FIB lookup functions directly (patches #1-#7) and
> in the input route path (patches #8-#12). Future patchsets will do the
> same in the output route path.
> 
> 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.
> 

for the set:
Reviewed-by: David Ahern <dsahern@kernel.org>
patchwork-bot+netdevbpf@kernel.org Aug. 23, 2024, 12:10 a.m. UTC | #3
Hello:

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

On Wed, 21 Aug 2024 15:52:39 +0300 you wrote:
> tl;dr - This patchset starts 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] bpf: Unmask upper DSCP bits in bpf_fib_lookup() helper
    https://git.kernel.org/netdev/net-next/c/ef434fae7228
  - [net-next,02/12] ipv4: Unmask upper DSCP bits in NETLINK_FIB_LOOKUP family
    https://git.kernel.org/netdev/net-next/c/bc52a4eecefd
  - [net-next,03/12] ipv4: Unmask upper DSCP bits when constructing the Record Route option
    https://git.kernel.org/netdev/net-next/c/be2e9089cb34
  - [net-next,04/12] netfilter: rpfilter: Unmask upper DSCP bits
    https://git.kernel.org/netdev/net-next/c/c1ae5ca69b69
  - [net-next,05/12] netfilter: nft_fib: Unmask upper DSCP bits
    https://git.kernel.org/netdev/net-next/c/338385e059c5
  - [net-next,06/12] ipv4: ipmr: Unmask upper DSCP bits in ipmr_rt_fib_lookup()
    https://git.kernel.org/netdev/net-next/c/2bc9778b6696
  - [net-next,07/12] ipv4: Unmask upper DSCP bits in fib_compute_spec_dst()
    https://git.kernel.org/netdev/net-next/c/39d3628f7cea
  - [net-next,08/12] ipv4: Unmask upper DSCP bits in input route lookup
    https://git.kernel.org/netdev/net-next/c/df9131c7fafd
  - [net-next,09/12] ipv4: Unmask upper DSCP bits in RTM_GETROUTE input route lookup
    https://git.kernel.org/netdev/net-next/c/b1251a6f1a9b
  - [net-next,10/12] ipv4: icmp: Pass full DS field to ip_route_input()
    https://git.kernel.org/netdev/net-next/c/1c6f50b37f71
  - [net-next,11/12] ipv4: udp: Unmask upper DSCP bits during early demux
    https://git.kernel.org/netdev/net-next/c/b6791ac5ea49
  - [net-next,12/12] ipv4: Unmask upper DSCP bits when using hints
    https://git.kernel.org/netdev/net-next/c/be8b8ded7799

You are awesome, thank you!