]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: fib_rules: Add DSCP mask attribute
authorIdo Schimmel <idosch@nvidia.com>
Thu, 20 Feb 2025 08:05:20 +0000 (10:05 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sat, 22 Feb 2025 00:08:47 +0000 (16:08 -0800)
Add an attribute that allows matching on DSCP with a mask. Matching on
DSCP with a mask is needed in deployments where users encode path
information into certain bits of the DSCP field.

Temporarily set the type of the attribute to 'NLA_REJECT' while support
is being added.

Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Guillaume Nault <gnault@redhat.com>
Link: https://patch.msgid.link/20250220080525.831924-2-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/uapi/linux/fib_rules.h
net/core/fib_rules.c

index 95ec01b15c654188bc3556851b83202b8d4384ef..2df6e4035d50b7388b4766ea8e1a7c71aa51a068 100644 (file)
@@ -72,6 +72,7 @@ enum {
        FRA_FLOWLABEL_MASK,     /* flowlabel mask */
        FRA_SPORT_MASK, /* sport mask */
        FRA_DPORT_MASK, /* dport mask */
+       FRA_DSCP_MASK,  /* dscp mask */
        __FRA_MAX
 };
 
index 5ddd34cbe7f6ddc274fd78f681d0a271fc1a0555..00e6fe79ecbaa3d1ffffd46743b1316007ba6e7a 100644 (file)
@@ -845,6 +845,7 @@ static const struct nla_policy fib_rule_policy[FRA_MAX + 1] = {
        [FRA_FLOWLABEL_MASK] = { .type = NLA_BE32 },
        [FRA_SPORT_MASK] = { .type = NLA_U16 },
        [FRA_DPORT_MASK] = { .type = NLA_U16 },
+       [FRA_DSCP_MASK] = { .type = NLA_REJECT },
 };
 
 int fib_newrule(struct net *net, struct sk_buff *skb, struct nlmsghdr *nlh,