]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: shell: check for removing table via handle with incorrect family
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 27 Jun 2024 00:51:57 +0000 (02:51 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 27 Jun 2024 01:32:55 +0000 (03:32 +0200)
This test checks for upstream commit:

f6e1532a2697 ("netfilter: nf_tables: validate family when identifying table via handle")

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/shell/testcases/transactions/handle_bad_family [new file with mode: 0755]

diff --git a/tests/shell/testcases/transactions/handle_bad_family b/tests/shell/testcases/transactions/handle_bad_family
new file mode 100755 (executable)
index 0000000..5922418
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+NFT=nft
+
+HANDLE=$($NFT -a -e add table ip x | cut -d '#' -f 2 | awk '{ print $2 }' | head -1)
+
+# should fail
+$NFT delete table inet handle $HANDLE
+[ $? -ne 0 ] && exit 0