]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
net/mlx5e: flower: validate encapsulation control flags
authorAsbjørn Sloth Tønnesen <ast@fiberby.net>
Sun, 9 Jun 2024 17:33:53 +0000 (17:33 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 13 Jun 2024 00:56:00 +0000 (17:56 -0700)
Encapsulation control flags are currently not used anywhere,
so all flags are currently unsupported by all drivers.

This patch adds validation of this assumption, so that
encapsulation flags may be used in the future.

In case any encapsulation control flags are masked,
flow_rule_match_has_enc_control_flags() sets a NL extended
error message, and we return -EOPNOTSUPP.

Only compile tested.

Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
Reviewed-by: Davide Caratti <dcaratti@redhat.com>
Link: https://lore.kernel.org/r/20240609173358.193178-4-ast@fiberby.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c

index 8dfb57f712b0dc8ae527880418dfe50d4cb1789c..721f35e5975795e052b00ff2b8852d49ab04bb57 100644 (file)
@@ -850,6 +850,12 @@ int mlx5e_tc_tun_parse(struct net_device *filter_dev,
                flow_rule_match_enc_control(rule, &match);
                addr_type = match.key->addr_type;
 
+               if (flow_rule_has_enc_control_flags(match.mask->flags,
+                                                   extack)) {
+                       err = -EOPNOTSUPP;
+                       goto out;
+               }
+
                /* For tunnel addr_type used same key id`s as for non-tunnel */
                if (addr_type == FLOW_DISSECTOR_KEY_IPV4_ADDRS) {
                        struct flow_match_ipv4_addrs match;