diff options
Diffstat (limited to 'abs/core/iptables/iptables-flush')
-rwxr-xr-x | abs/core/iptables/iptables-flush | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/abs/core/iptables/iptables-flush b/abs/core/iptables/iptables-flush new file mode 100755 index 0000000..e6fafe9 --- /dev/null +++ b/abs/core/iptables/iptables-flush @@ -0,0 +1,18 @@ +#!/bin/bash +# +# Usage: iptables-flush [6] +# + +iptables=ip$1tables +if ! type -p "$iptables"; then + echo "error: invalid argument" + exit 1 +fi + +while read -r table; do + tables+=("/var/lib/$iptables/empty-$table.rules") +done <"/proc/net/ip$1_tables_names" + +if (( ${#tables[*]} )); then + cat "${tables[@]}" | "$iptables-restore" +fi |