mbox series

[net-next,0/8] net: fib_rules: Add port mask support

Message ID 20250217134109.311176-1-idosch@nvidia.com (mailing list archive)
Headers show
Series net: fib_rules: Add port mask support | expand

Message

Ido Schimmel Feb. 17, 2025, 1:41 p.m. UTC
In some deployments users would like to encode path information into
certain bits of the IPv6 flow label, the UDP source port and the DSCP
field and use this information to route packets accordingly.

Redirecting traffic to a routing table based on specific bits in the UDP
source port is not currently possible. Only exact match and range are
currently supported by FIB rules.

This patchset extends FIB rules to match on layer 4 ports with an
optional mask. The mask is not supported when matching on a range. A
future patchset will add support for matching on the DSCP field with an
optional mask.

Patches #1-#6 gradually extend FIB rules to match on layer 4 ports with
an optional mask.

Patches #7-#8 add test cases for FIB rule port matching.

iproute2 support can be found here [1].

[1] https://github.com/idosch/iproute2/tree/submit/fib_rule_mask_v1

Ido Schimmel (8):
  net: fib_rules: Add port mask attributes
  net: fib_rules: Add port mask support
  ipv4: fib_rules: Add port mask matching
  ipv6: fib_rules: Add port mask matching
  net: fib_rules: Enable port mask usage
  netlink: specs: Add FIB rule port mask attributes
  selftests: fib_rule_tests: Add port range match tests
  selftests: fib_rule_tests: Add port mask match tests

 Documentation/netlink/specs/rt_rule.yaml      | 10 +++
 include/net/fib_rules.h                       | 19 +++++
 include/uapi/linux/fib_rules.h                |  2 +
 net/core/fib_rules.c                          | 69 ++++++++++++++++++-
 net/ipv4/fib_rules.c                          |  8 +--
 net/ipv6/fib6_rules.c                         |  8 +--
 tools/testing/selftests/net/fib_rule_tests.sh | 36 ++++++++++
 7 files changed, 143 insertions(+), 9 deletions(-)

Comments

Guillaume Nault Feb. 18, 2025, 12:16 p.m. UTC | #1
On Mon, Feb 17, 2025 at 03:41:01PM +0200, Ido Schimmel wrote:
> This patchset extends FIB rules to match on layer 4 ports with an
> optional mask. The mask is not supported when matching on a range. A
> future patchset will add support for matching on the DSCP field with an
> optional mask.
> 

Reviewed-by: Guillaume Nault <gnault@redhat.com>
David Ahern Feb. 19, 2025, 3:22 p.m. UTC | #2
On 2/17/25 6:41 AM, Ido Schimmel wrote:
> In some deployments users would like to encode path information into
> certain bits of the IPv6 flow label, the UDP source port and the DSCP
> field and use this information to route packets accordingly.
> 
> Redirecting traffic to a routing table based on specific bits in the UDP
> source port is not currently possible. Only exact match and range are
> currently supported by FIB rules.
> 
> This patchset extends FIB rules to match on layer 4 ports with an
> optional mask. The mask is not supported when matching on a range. A
> future patchset will add support for matching on the DSCP field with an
> optional mask.
> 
> Patches #1-#6 gradually extend FIB rules to match on layer 4 ports with
> an optional mask.
> 
> Patches #7-#8 add test cases for FIB rule port matching.
> 
> iproute2 support can be found here [1].
> 
> [1] https://github.com/idosch/iproute2/tree/submit/fib_rule_mask_v1
> 
> Ido Schimmel (8):
>   net: fib_rules: Add port mask attributes
>   net: fib_rules: Add port mask support
>   ipv4: fib_rules: Add port mask matching
>   ipv6: fib_rules: Add port mask matching
>   net: fib_rules: Enable port mask usage
>   netlink: specs: Add FIB rule port mask attributes
>   selftests: fib_rule_tests: Add port range match tests
>   selftests: fib_rule_tests: Add port mask match tests
> 
>  Documentation/netlink/specs/rt_rule.yaml      | 10 +++
>  include/net/fib_rules.h                       | 19 +++++
>  include/uapi/linux/fib_rules.h                |  2 +
>  net/core/fib_rules.c                          | 69 ++++++++++++++++++-
>  net/ipv4/fib_rules.c                          |  8 +--
>  net/ipv6/fib6_rules.c                         |  8 +--
>  tools/testing/selftests/net/fib_rule_tests.sh | 36 ++++++++++
>  7 files changed, 143 insertions(+), 9 deletions(-)
> 

For the set:
Reviewed-by: David Ahern <dsahern@kernel.org>
patchwork-bot+netdevbpf@kernel.org Feb. 20, 2025, 2:50 a.m. UTC | #3
Hello:

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

On Mon, 17 Feb 2025 15:41:01 +0200 you wrote:
> In some deployments users would like to encode path information into
> certain bits of the IPv6 flow label, the UDP source port and the DSCP
> field and use this information to route packets accordingly.
> 
> Redirecting traffic to a routing table based on specific bits in the UDP
> source port is not currently possible. Only exact match and range are
> currently supported by FIB rules.
> 
> [...]

Here is the summary with links:
  - [net-next,1/8] net: fib_rules: Add port mask attributes
    https://git.kernel.org/netdev/net-next/c/39f970aead3c
  - [net-next,2/8] net: fib_rules: Add port mask support
    https://git.kernel.org/netdev/net-next/c/da7665947b66
  - [net-next,3/8] ipv4: fib_rules: Add port mask matching
    https://git.kernel.org/netdev/net-next/c/79a4e21584b7
  - [net-next,4/8] ipv6: fib_rules: Add port mask matching
    https://git.kernel.org/netdev/net-next/c/fc1266a06164
  - [net-next,5/8] net: fib_rules: Enable port mask usage
    https://git.kernel.org/netdev/net-next/c/34e406a84928
  - [net-next,6/8] netlink: specs: Add FIB rule port mask attributes
    https://git.kernel.org/netdev/net-next/c/ab35ebfabb53
  - [net-next,7/8] selftests: fib_rule_tests: Add port range match tests
    https://git.kernel.org/netdev/net-next/c/94694aa64100
  - [net-next,8/8] selftests: fib_rule_tests: Add port mask match tests
    https://git.kernel.org/netdev/net-next/c/f5d783c08875

You are awesome, thank you!