3 # Based on updateipt.sh by Phil Sutter:
4 # https://developers.redhat.com/blog/2017/01/10/migrating-my-iptables-setup-to-nftables/
6 # useful wrappers for failure analysis
7 cmd_or_print() { # command
8 "$@" || echo "failed at: '$*'"
11 ipt() { # iptables params
12 cmd_or_print iptables "$@"
15 ip6t() { # ip6tables params
16 cmd_or_print ip6tables "$@"
19 # have a simple way of doing things in iptables and ip6tables in parallel
20 ip46t() { # ip(6)tables params
25 # clear out everything
27 for it in iptables ip6tables; do
28 for table in filter mangle nat raw; do
29 $it -t $table -nL >/dev/null 2>&1 || continue # non-existing table
31 $it -t $table -F # delete rules
32 $it -t $table -X # delete custom chains
33 $it -t $table -Z # zero counters