Skip to content

Commit 39f970a

Browse files
idoschkuba-moo
authored andcommitted
net: fib_rules: Add port mask attributes
Add attributes that allow matching on source and destination ports with a mask. Matching on the source port with a mask is needed in deployments where users encode path information into certain bits of the UDP source port. Temporarily set the type of the attributes 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> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://patch.msgid.link/20250217134109.311176-2-idosch@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent dfc4b67 commit 39f970a

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

include/uapi/linux/fib_rules.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ enum {
7070
FRA_DSCP, /* dscp */
7171
FRA_FLOWLABEL, /* flowlabel */
7272
FRA_FLOWLABEL_MASK, /* flowlabel mask */
73+
FRA_SPORT_MASK, /* sport mask */
74+
FRA_DPORT_MASK, /* dport mask */
7375
__FRA_MAX
7476
};
7577

net/core/fib_rules.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,8 @@ static const struct nla_policy fib_rule_policy[FRA_MAX + 1] = {
784784
[FRA_DSCP] = NLA_POLICY_MAX(NLA_U8, INET_DSCP_MASK >> 2),
785785
[FRA_FLOWLABEL] = { .type = NLA_BE32 },
786786
[FRA_FLOWLABEL_MASK] = { .type = NLA_BE32 },
787+
[FRA_SPORT_MASK] = { .type = NLA_REJECT },
788+
[FRA_DPORT_MASK] = { .type = NLA_REJECT },
787789
};
788790

789791
int fib_newrule(struct net *net, struct sk_buff *skb, struct nlmsghdr *nlh,

0 commit comments

Comments
 (0)