]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ipv4: fib_rules: Reject flow label attributes
authorIdo Schimmel <idosch@nvidia.com>
Mon, 16 Dec 2024 17:11:54 +0000 (19:11 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 19 Dec 2024 15:02:21 +0000 (16:02 +0100)
IPv4 FIB rules cannot match on flow label so reject requests that try to
add such rules. Do that in the IPv4 configure callback as the netlink
policy resides in the core and used by both IPv4 and IPv6.

Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/ipv4/fib_rules.c

index 8325224ef07232d05b59c58011625daae847af30..9517b8667e00029aba5b8a5ab96076eb1a8d9ea2 100644 (file)
@@ -249,6 +249,12 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
        int err = -EINVAL;
        struct fib4_rule *rule4 = (struct fib4_rule *) rule;
 
+       if (tb[FRA_FLOWLABEL] || tb[FRA_FLOWLABEL_MASK]) {
+               NL_SET_ERR_MSG(extack,
+                              "Flow label cannot be specified for IPv4 FIB rules");
+               goto errout;
+       }
+
        if (!inet_validate_dscp(frh->tos)) {
                NL_SET_ERR_MSG(extack,
                               "Invalid dsfield (tos): ECN bits must be 0");