From 0bd7a8eaf3582159490ab355b1217a4e42ed021f Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 2 Oct 2020 13:44:36 +0200 Subject: iptables-nft: fix basechain policy configuration Previous to this patch, the basechain policy could not be properly configured if it wasn't explictly set when loading the ruleset, leading to iptables-nft-restore (and ip6tables-nft-restore) trying to send an invalid ruleset to the kernel. Signed-off-by: Arturo Borrero Gonzalez Signed-off-by: Pablo Neira Ayuso --- .../testcases/nft-only/0008-basechain-policy_0 | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 iptables/tests/shell/testcases/nft-only/0008-basechain-policy_0 (limited to 'iptables/tests') diff --git a/iptables/tests/shell/testcases/nft-only/0008-basechain-policy_0 b/iptables/tests/shell/testcases/nft-only/0008-basechain-policy_0 new file mode 100755 index 00000000..a81e9bad --- /dev/null +++ b/iptables/tests/shell/testcases/nft-only/0008-basechain-policy_0 @@ -0,0 +1,29 @@ +#!/bin/bash + +[[ $XT_MULTI == *xtables-nft-multi ]] || { echo "skip $XT_MULTI"; exit 0; } +set -e + +$XT_MULTI iptables -t raw -P OUTPUT DROP + +# make sure iptables-nft-restore can correctly handle basechain policies when +# they aren't set with --noflush +# +$XT_MULTI iptables-restore --noflush <