tests: shell: add test case for netdev + dormant table
Florian Westphal
maintainerPATCH 1/1 tests: shell: add test case for netdev + dormant table
both commit update and abort path need to release memory associated with netdev hooks. kfree gets skipped because it mixes registration and allocation.
Signed-off-by Florian Westphal <[email protected]>
--- .../transactions/dormant_updchain_abort | 23 +++++++++++++ .../dumps/dormant_updchain_abort.json-nft | 33 +++++++++++++++++++ .../dumps/dormant_updchain_abort.nft | 7 ++++ 3 files changed, 63 insertions(+) create mode 100755 tests/shell/testcases/transactions/dormant_updchain_abort create mode 100644 tests/shell/testcases/transactions/dumps/dormant_updchain_abort.json-nft create mode 100644 tests/shell/testcases/transactions/dumps/dormant_updchain_abort.nft
tests/shell/testcases/transactions/dormant_updchain_abort new file +23 -0
@@ -0,0 +1,23 @@ +#!/bin/bash + +set -e + +$NFT -f - <<EOF +table netdev t { + flags dormant + + chain c { + type filter hook ingress priority 0 + } +} +EOF + +# check abort path frees transaction +$NFT --check --f - <<EOF +table netdev t { + flags dormant + chain c { + type filter hook ingress device lo priority 0 + } +} +EOF
tests/shell/testcases/transactions/dumps/dormant_updchain_abort.json-nft new file +33 -0
@@ -0,0 +1,33 @@ +{ + "nftables": [ + { + "metainfo": { + "version": "VERSION", + "release_name": "RELEASE_NAME", + "json_schema_version": 1 + } + }, + { + "table": { + "family": "netdev", + "name": "t", + "handle": 0, + "flags": [ + "dormant" + ] + } + }, + { + "chain": { + "family": "netdev", + "table": "t", + "name": "c", + "handle": 0, + "type": "filter", + "hook": "ingress", + "prio": 0, + "policy": "accept" + } + } + ] +}
tests/shell/testcases/transactions/dumps/dormant_updchain_abort.nft new file +7 -0
@@ -0,0 +1,7 @@ +table netdev t { + flags dormant + + chain c { + type filter hook ingress priority filter; policy accept; + } +}
Signature · 1 line
2.53.0
Florian Westphal
maintainerQuoted 3 lines · Florian Westphal
both commit update and abort path need to release memory associated with netdev hooks. kfree gets skipped because it mixes registration and allocation.
I have a kernel fix for this bug but I am waiting for the pending PR to get merged before sending it, the fix depends on the new unlink+free helper and doesn't apply to main branch.