mbox series

[net-next,v2,0/3] Preparations for FIB rule DSCP selector

Message ID 20240814125224.972815-1-idosch@nvidia.com (mailing list archive)
Headers show
Series Preparations for FIB rule DSCP selector | expand

Message

Ido Schimmel Aug. 14, 2024, 12:52 p.m. UTC
This patchset moves the masking of the upper DSCP bits in 'flowi4_tos'
to the core instead of relying on callers of the FIB lookup API to do
it.

This will allow us to start changing users of the API to initialize the
'flowi4_tos' field with all six bits of the DSCP field. In turn, this
will allow us to extend FIB rules with a new DSCP selector.

By masking the upper DSCP bits in the core we are able to maintain the
behavior of the TOS selector in FIB rules and routes to only match on
the lower DSCP bits.

While working on this I found two users of the API that do not mask the
upper DSCP bits before performing the lookup. The first is an ancient
netlink family that is unlikely to be used. It is adjusted in patch #1
to mask both the upper DSCP bits and the ECN bits before calling the
API.

The second user is a nftables module that differs in this regard from
its equivalent iptables module. It is adjusted in patch #2 to invoke the
API with the upper DSCP bits masked, like all other callers. The
relevant selftest passed, but in the unlikely case that regressions are
reported because of this change, we can restore the existing behavior
using a new flow information flag as discussed here [1].

The last patch moves the masking of the upper DSCP bits to the core,
making the first two patches redundant, but I wanted to post them
separately to call attention to the behavior change for these two users
of the FIB lookup API.

Future patchsets (around 3) will start unmasking the upper DSCP bits
throughout the networking stack before adding support for the new FIB
rule DSCP selector.

Changes from v1 [2]:

Patch #3: Include <linux/ip.h> in <linux/in_route.h> instead of
including it in net/ip_fib.h

[1] https://lore.kernel.org/netdev/ZpqpB8vJU%2FQ6LSqa@debian/
[2] https://lore.kernel.org/netdev/20240725131729.1729103-1-idosch@nvidia.com/

Ido Schimmel (3):
  ipv4: Mask upper DSCP bits and ECN bits in NETLINK_FIB_LOOKUP family
  netfilter: nft_fib: Mask upper DSCP bits before FIB lookup
  ipv4: Centralize TOS matching

 include/net/ip_fib.h              | 6 ++++++
 include/uapi/linux/in_route.h     | 2 ++
 net/ipv4/fib_frontend.c           | 2 +-
 net/ipv4/fib_rules.c              | 2 +-
 net/ipv4/fib_semantics.c          | 3 +--
 net/ipv4/fib_trie.c               | 3 +--
 net/ipv4/netfilter/nft_fib_ipv4.c | 4 +---
 7 files changed, 13 insertions(+), 9 deletions(-)

Comments

Guillaume Nault Aug. 14, 2024, 1:36 p.m. UTC | #1
On Wed, Aug 14, 2024 at 03:52:21PM +0300, Ido Schimmel wrote:
> This patchset moves the masking of the upper DSCP bits in 'flowi4_tos'
> to the core instead of relying on callers of the FIB lookup API to do
> it.

FWIW, I plan to review this patch set next week (I'm mostly offline
this week).
patchwork-bot+netdevbpf@kernel.org Aug. 20, 2024, 1:14 p.m. UTC | #2
Hello:

This series was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Wed, 14 Aug 2024 15:52:21 +0300 you wrote:
> This patchset moves the masking of the upper DSCP bits in 'flowi4_tos'
> to the core instead of relying on callers of the FIB lookup API to do
> it.
> 
> This will allow us to start changing users of the API to initialize the
> 'flowi4_tos' field with all six bits of the DSCP field. In turn, this
> will allow us to extend FIB rules with a new DSCP selector.
> 
> [...]

Here is the summary with links:
  - [net-next,v2,1/3] ipv4: Mask upper DSCP bits and ECN bits in NETLINK_FIB_LOOKUP family
    https://git.kernel.org/netdev/net-next/c/8fed54758cd2
  - [net-next,v2,2/3] netfilter: nft_fib: Mask upper DSCP bits before FIB lookup
    https://git.kernel.org/netdev/net-next/c/548a2029eb66
  - [net-next,v2,3/3] ipv4: Centralize TOS matching
    https://git.kernel.org/netdev/net-next/c/1fa3314c14c6

You are awesome, thank you!