Reading table names from /proc instead of using grep
This commit is contained in:
parent
9d6e838aa5
commit
560dc05e2a
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user