summarylogtreecommitdiffstats
path: root/iptables-legacy-flush
diff options
context:
space:
mode:
Diffstat (limited to 'iptables-legacy-flush')
-rw-r--r--iptables-legacy-flush18
1 files changed, 18 insertions, 0 deletions
diff --git a/iptables-legacy-flush b/iptables-legacy-flush
new file mode 100644
index 000000000000..3d8ee893f611
--- /dev/null
+++ b/iptables-legacy-flush
@@ -0,0 +1,18 @@
+#!/bin/bash
+#
+# Usage: iptables-flush [6]
+#
+
+iptables=ip$1tables
+if ! type -p "$iptables" &>/dev/null; then
+ echo "error: invalid argument"
+ exit 1
+fi
+
+while read -r table; do
+ tables+=("/usr/share/iptables/empty-$table.rules")
+done <"/proc/net/ip$1_tables_names"
+
+if (( ${#tables[*]} )); then
+ cat "${tables[@]}" | "$iptables-restore"
+fi