Skip to contentSkip to conversation

mlxsw: spectrum_flower: validate control flags

PATCH Applied Asbjørn Sloth Tønnesen 4 participants 5 messages Apr 17, 2024 – Apr 19, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mlxsw: spectrum_flower: validate control flags

This driver currently doesn't support any control flags.

Use flow_rule_has_control_flags() to check for control flags, such as can be set through tc flower ... ip_flags frag.

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

Only compile-tested.

---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c +4 -0
index 9fd1ca079258..f07955b5439f 100644
@@ -595,6 +595,10 @@ static int mlxsw_sp_flower_parse(struct mlxsw_sp *mlxsw_sp,
 
 		flow_rule_match_control(rule, &match);
 		addr_type = match.key->addr_type;
+
+		if (flow_rule_has_control_flags(match.mask->flags,
+						f->common.extack))
+			return -EOPNOTSUPP;
 	}
 
 	if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_BASIC)) {
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 11 lines · Asbjørn Sloth Tønnesen

This driver currently doesn't support any control flags.

Use flow_rule_has_control_flags() to check for control flags, such as can be set through tc flower ... ip_flags frag.

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

Only compile-tested.

Thanks, I'll take this through our regression.

maintainer Tested-by
#2 lore raw
Quoted 7 lines · Petr Machata
Quoted 5 lines · Asbjørn Sloth Tønnesen

This driver currently doesn't support any control flags.

Use flow_rule_has_control_flags() to check for control flags, such as can be set through tc flower ... ip_flags frag.

Quoted 8 lines
Quoted 6 lines

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

Only compile-tested.

Thanks, I'll take this through our regression.

Nothing bombed.

maintainer Reviewed-by Tested-by on v1 1/1
#3 lore raw
In reply to Asbjørn Sloth Tønnesen
Quoted 11 lines · Asbjørn Sloth Tønnesen

This driver currently doesn't support any control flags.

Use flow_rule_has_control_flags() to check for control flags, such as can be set through tc flower ... ip_flags frag.

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

Only compile-tested.

Without patch:

+ tc qdisc add dev swp1 clsact
+ tc filter add dev swp1 ingress pref 1 proto ip flower skip_sw ip_flags frag action drop
+ tc filter add dev swp1 ingress pref 1 proto ip flower skip_sw ip_flags nofrag action drop
+ tc filter add dev swp1 ingress pref 1 proto ip flower skip_sw ip_flags firstfrag action drop
+ tc filter add dev swp1 ingress pref 1 proto ip flower skip_sw ip_flags nofirstfrag action drop

With patch:

+ tc qdisc add dev swp1 clsact
+ tc filter add dev swp1 ingress pref 1 proto ip flower skip_sw ip_flags frag action drop
Error: mlxsw_spectrum: Unsupported match on control.flags 0x1.
We have an error talking to the kernel
+ tc filter add dev swp1 ingress pref 1 proto ip flower skip_sw ip_flags nofrag action drop
Error: mlxsw_spectrum: Unsupported match on control.flags 0x1.
We have an error talking to the kernel
+ tc filter add dev swp1 ingress pref 1 proto ip flower skip_sw ip_flags firstfrag action drop
Error: mlxsw_spectrum: Unsupported match on control.flags 0x2.
We have an error talking to the kernel
+ tc filter add dev swp1 ingress pref 1 proto ip flower skip_sw ip_flags nofirstfrag action drop
Error: mlxsw_spectrum: Unsupported match on control.flags 0x2.
We have an error talking to the kernel

Thanks!

#4 lore raw
In reply to Asbjørn Sloth Tønnesen
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Wed, 17 Apr 2024 13:51:20 +0000 you wrote:

This driver currently doesn't support any control flags.

Use flow_rule_has_control_flags() to check for control flags, such as can be set through tc flower ... ip_flags frag.

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

[...]

Here is the summary with links:
- [net-next] mlxsw: spectrum_flower: validate control flags

    https://git.kernel.org/netdev/net-next/c/4713744d9f6e

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html