selftests: netfilter: add nfqueue test case
Florian Westphal
maintainerPATCH 1/1 selftests: netfilter: add nfqueue test case
Add a test case to check nf queue infrastructure. Could be extended in the future to also cover serialization of conntrack, uid and secctx attributes in nfqueue.
For now, this checks that 'queue bypass' works, that a queue rule with no bypass option blocks traffic and that userspace receives the expected number of packets.
For this we add two queues and hook all of prerouting/input/forward/output/postrouting.
Packets get queued twice with a dummy base chain in between:
This passes with current nf tree, but reverting
commit 946c0d8e6ed4 ("netfilter: nf_queue: fix reinject verdict handling") makes this trip (it processes 30 instead of expected 20 packets).
--- tools/testing/selftests/netfilter/.gitignore | 1 + tools/testing/selftests/netfilter/Makefile | 5 +- tools/testing/selftests/netfilter/nf-queue.c | 281 ++++++++++++++++++ .../testing/selftests/netfilter/nft_queue.sh | 274 +++++++++++++++++ 4 files changed, 560 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/netfilter/.gitignore create mode 100644 tools/testing/selftests/netfilter/nf-queue.c create mode 100755 tools/testing/selftests/netfilter/nft_queue.sh
tools/testing/selftests/netfilter/.gitignore new file +1 -0
@@ -0,0 +1 @@ +nf-queue
tools/testing/selftests/netfilter/Makefile +4 -1
@@ -2,6 +2,9 @@ # Makefile for netfilter selftests TEST_PROGS := nft_trans_stress.sh nft_nat.sh bridge_brouter.sh \ - conntrack_icmp_related.sh nft_flowtable.sh + conntrack_icmp_related.sh nft_flowtable.sh nft_queue.sh + +LDLIBS = -lmnl +TEST_GEN_FILES = nf-queue include ../lib.mk
tools/testing/selftests/netfilter/nf-queue.c new file +281 -0
281 lines not on this page · raw message
tools/testing/selftests/netfilter/nft_queue.sh new file +274 -0
274 lines not on this page · raw message
Signature · 1 line
2.21.0