Commit 5a1b015d authored by Asbjørn Sloth Tønnesen's avatar Asbjørn Sloth Tønnesen Committed by Jakub Kicinski
Browse files

ice: flower: validate encapsulation control flags



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: default avatarAsbjørn Sloth Tønnesen <ast@fiberby.net>
Reviewed-by: default avatarMarcin Szycik <marcin.szycik@linux.intel.com>
Reviewed-by: default avatarDavide Caratti <dcaratti@redhat.com>
Link: https://lore.kernel.org/r/20240609173358.193178-6-ast@fiberby.net


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 34cdd984
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1353,6 +1353,7 @@ ice_parse_tunnel_attr(struct net_device *dev, struct flow_rule *rule,
		      struct ice_tc_flower_fltr *fltr)
{
	struct ice_tc_flower_lyr_2_4_hdrs *headers = &fltr->outer_headers;
	struct netlink_ext_ack *extack = fltr->extack;
	struct flow_match_control enc_control;

	fltr->tunnel_type = ice_tc_tun_get_type(dev);
@@ -1373,6 +1374,9 @@ ice_parse_tunnel_attr(struct net_device *dev, struct flow_rule *rule,

	flow_rule_match_enc_control(rule, &enc_control);

	if (flow_rule_has_enc_control_flags(enc_control.mask->flags, extack))
		return -EOPNOTSUPP;

	if (enc_control.key->addr_type == FLOW_DISSECTOR_KEY_IPV4_ADDRS) {
		struct flow_match_ipv4_addrs match;