selftests/net/openvswitch: add SCTP flow key support and test
Subsystems (4)
PATCH v10 1/1 selftests/net/openvswitch: add SCTP flow key support and test
The ovskey flow-string parser has no OVS_KEY_ATTR_SCTP entry, so a flow string containing sctp(src=.../dst=...) parses without error but silently drops the L4 key. The resulting flow carries only ipv4(proto=132), and the kernel rejects it: match_validate() in flow_netlink.c requires OVS_KEY_ATTR_SCTP when the IP protocol is IPPROTO_SCTP and returns -EINVAL for the missing key.
Register OVS_KEY_ATTR_SCTP in the parse table and add a matching selftest that verifies SCTP flow key matching (sctp src/dst port).
One listener serves the whole test. socat's fork option handles each association in a child, so the flow rules are the only thing that changes between the three phases and the listener is never restarted underneath them. -t 1 bounds how long a forked child lingers after its association closes, and the existing kill -TERM of the captured pid on teardown removes the listener itself.
Also enable CONFIG_IP_SCTP in the selftest kernel config. The config checker strips underscores before comparing keys, so the entry sorts before CONFIG_IPV6 rather than after it.
---
v10:
- drop the sctp() key probe. OVS_KEY_ATTR_SCTP is unconditional in the kernel datapath (no kconfig gates it in flow_netlink.c), so the probe only ever fired for a missing ovs-dpctl.py parse-table entry and turned that regression into a skip: the same gap that hid the v5 loss. A parse-table regression now fails the test instead of skipping it (Jakub)
- drop setsid. The forked children exit when their association closes, socat -t 1 bounds how long they linger, and the existing kill -TERM of the captured pid removes the listener itself (Jakub)
- bound listener child lifetime with socat -t 1 (Jakub)
v9:
- one forking listener for the whole test instead of restarting it between phases (Aaron)
- signal the daemon's process group on cleanup so the children a forking listener leaves behind are reaped
- sort CONFIG_IP_SCTP the way the config checker compares keys
v8: https://lore.kernel.org/netdev/[email protected]/
v7: https://lore.kernel.org/netdev/[email protected]/
v6: https://lore.kernel.org/netdev/[email protected]/
v5: https://lore.kernel.org/netdev/[email protected]/
v4: https://lore.kernel.org/netdev/[email protected]/
v3: https://lore.kernel.org/netdev/[email protected]/
v2: https://lore.kernel.org/netdev/[email protected]/
v1: https://lore.kernel.org/netdev/[email protected]/
--- .../testing/selftests/net/openvswitch/config | 1 + .../selftests/net/openvswitch/openvswitch.sh | 90 +++++++++++++++++++ .../selftests/net/openvswitch/ovs-dpctl.py | 5 ++ 3 files changed, 96 insertions(+)
tools/testing/selftests/net/openvswitch/config +1 -0
@@ -1,5 +1,6 @@ CONFIG_GENEVE=m CONFIG_INET_DIAG=y +CONFIG_IP_SCTP=y CONFIG_IPV6=y CONFIG_NETFILTER=y CONFIG_NET_IPGRE=m
tools/testing/selftests/net/openvswitch/openvswitch.sh +90 -0
102 lines not on this page · raw message
tools/testing/selftests/net/openvswitch/ovs-dpctl.py +5 -0
@@ -1984,6 +1984,11 @@ class ovskey(nla): "udp", ovskey.ovs_key_udp, ), + ( + "OVS_KEY_ATTR_SCTP", + "sctp", + ovskey.ovs_key_sctp, + ), ( "OVS_KEY_ATTR_ICMP", "icmp",
Signature · 1 line
2.55.0
Quoted 17 lines · Minxi Hou
The ovskey flow-string parser has no
OVS_KEY_ATTR_SCTPentry, so a flow string containing sctp(src=.../dst=...) parses without error but silently drops the L4 key. The resulting flow carries only ipv4(proto=132), and the kernel rejects it:match_validate()inflow_netlink.crequiresOVS_KEY_ATTR_SCTPwhen the IP protocol isIPPROTO_SCTPand returns-EINVALfor the missing key.Register
OVS_KEY_ATTR_SCTPin the parse table and add a matching selftest that verifies SCTP flow key matching (sctp src/dst port).One listener serves the whole test. socat's fork option handles each association in a child, so the flow rules are the only thing that changes between the three phases and the listener is never restarted underneath them. -t 1 bounds how long a forked child lingers after its association closes, and the existing kill -TERM of the captured pid on teardown removes the listener itself.
Quoted 6 lines
Also enable
CONFIG_IP_SCTPin the selftest kernel config. The config checker strips underscores before comparing keys, so the entry sorts beforeCONFIG_IPV6rather than after it.Signed-off-by Minxi Hou <[email protected]>---
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 8 lines · On Tue, 11 Aug 2026 14:16:45 -0400 you wrote:
The ovskey flow-string parser has no
OVS_KEY_ATTR_SCTPentry, so a flow string containing sctp(src=.../dst=...) parses without error but silently drops the L4 key. The resulting flow carries only ipv4(proto=132), and the kernel rejects it:match_validate()inflow_netlink.crequiresOVS_KEY_ATTR_SCTPwhen the IP protocol isIPPROTO_SCTPand returns-EINVALfor the missing key.[...]
Here is the summary with links:
- [net-next,v10] selftests/net/openvswitch: add SCTP flow key support and test
https://git.kernel.org/netdev/net-next/c/07a9e3975039
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html