]> www.infradead.org Git - users/willy/xarray.git/commitdiff
net: fib_rules: Enable DSCP selector usage
authorIdo Schimmel <idosch@nvidia.com>
Wed, 11 Sep 2024 09:37:46 +0000 (12:37 +0300)
committerJakub Kicinski <kuba@kernel.org>
Sat, 14 Sep 2024 04:15:45 +0000 (21:15 -0700)
Now that both IPv4 and IPv6 support the new DSCP selector, enable user
space to configure FIB rules that make use of it by changing the policy
of the new DSCP attribute so that it accepts values in the range of [0,
63].

Use NLA_U8 rather than NLA_UINT as the field is of fixed size.

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/20240911093748.3662015-5-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/fib_rules.c

index df41c05f723427489158b7038fab313ae793bb93..154a2681f55cc6861d418927c396bec5d840578c 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/list.h>
 #include <linux/module.h>
 #include <net/net_namespace.h>
+#include <net/inet_dscp.h>
 #include <net/sock.h>
 #include <net/fib_rules.h>
 #include <net/ip_tunnels.h>
@@ -767,7 +768,7 @@ static const struct nla_policy fib_rule_policy[FRA_MAX + 1] = {
        [FRA_IP_PROTO]  = { .type = NLA_U8 },
        [FRA_SPORT_RANGE] = { .len = sizeof(struct fib_rule_port_range) },
        [FRA_DPORT_RANGE] = { .len = sizeof(struct fib_rule_port_range) },
-       [FRA_DSCP]      = { .type = NLA_REJECT },
+       [FRA_DSCP]      = NLA_POLICY_MAX(NLA_U8, INET_DSCP_MASK >> 2),
 };
 
 int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh,