Reading table names from /proc instead of using grep

This commit is contained in:
Jack L. Frost 2014-03-10 03:25:17 +04:00
parent 9d6e838aa5
commit 560dc05e2a

View File

@ -17,8 +17,13 @@ stop() {
iptables-save | sed -re 's/(:[A-Z]+\s+)[A-Z]+/\1ACCEPT/g' -e '/-.+/d' | iptables-restore
ip6tables-save | sed -re 's/(:[A-Z]+\s+)[A-Z]+/\1ACCEPT/g' -e '/-.+/d' | ip6tables-restore
for i in $(iptables-save | grep -E '^\*'); do iptables -t "${i//\*/}" -X; done
for i in $(ip6tables-save | grep -E '^\*'); do ip6tables -t "${i//\*/}" -X; done
[[ -f '/proc/net/ip_tables_names' ]] && {
while read line; do iptables -t "$line" -X < /proc/net/ip_tables_names; done
}
[[ -f '/proc/net/ip6_tables_names' ]] && {
while read line; do iptables -t "$line" -X < /proc/net/ip6_tables_names; done
}
}
save() {