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
70 FRA_DSCP, /* dscp */70 FRA_DSCP, /* dscp */
71 FRA_FLOWLABEL, /* flowlabel */71 FRA_FLOWLABEL, /* flowlabel */
72 FRA_FLOWLABEL_MASK, /* flowlabel mask */72 FRA_FLOWLABEL_MASK, /* flowlabel mask */
73 FRA_SPORT_MASK, /* sport mask */
74 FRA_DPORT_MASK, /* dport mask */
73 __FRA_MAX75 __FRA_MAX
74};76};
75 77
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
784 [FRA_DSCP] = NLA_POLICY_MAX(NLA_U8, INET_DSCP_MASK >> 2),784 [FRA_DSCP] = NLA_POLICY_MAX(NLA_U8, INET_DSCP_MASK >> 2),
785 [FRA_FLOWLABEL] = { .type = NLA_BE32 },785 [FRA_FLOWLABEL] = { .type = NLA_BE32 },
786 [FRA_FLOWLABEL_MASK] = { .type = NLA_BE32 },786 [FRA_FLOWLABEL_MASK] = { .type = NLA_BE32 },
787 [FRA_SPORT_MASK] = { .type = NLA_REJECT },
788 [FRA_DPORT_MASK] = { .type = NLA_REJECT },
787};789};
788 790
789int fib_newrule(struct net *net, struct sk_buff *skb, struct nlmsghdr *nlh,791int fib_newrule(struct net *net, struct sk_buff *skb, struct nlmsghdr *nlh,