History

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.

Ido Schimmel committed 1 year ago

Commit 39f970a1 parent dfc4b672 files · +4 −0Browse files

Unified · Split

2 files
  1. include/uapi/linux/fib_rules.h +2 −0
  2. net/core/fib_rules.c +2 −0
include/uapi/linux/fib_rules.h+2−0
@@ -70,6 +70,8 @@ enum { · 69 unmodified lines
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+2−0
@@ -784,6 +784,8 @@ static const struct nla_policy fib_rule_policy[FRA_MAX + 1] = { · 783 unmodified lines
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,