From 7a1aa39f9507d9d2417bad126c7a1a5321f8f8af Mon Sep 17 00:00:00 2001 From: teastep Date: Thu, 5 Dec 2002 00:18:47 +0000 Subject: [PATCH] Speed up running of iptables git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@351 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall/firewall | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Shorewall/firewall b/Shorewall/firewall index c8e4e2d29..efd463c61 100755 --- a/Shorewall/firewall +++ b/Shorewall/firewall @@ -143,11 +143,29 @@ expandv() # $* = list of variable names done } +# +# Replace all "!' with "! " in the passed argument list +# + +fix_bang() { + local i; + for i in $@; do + case $i in + !*) + echo "! ${i#!}" + ;; + *) + echo $i + ;; + esac + done +} + # # Run iptables and if an error occurs, stop the firewall and quit # run_iptables() { - if ! iptables `echo $@ | sed 's/!/! /g'`; then + if ! iptables `fix_bang $@`; then [ -z "$stopping" ] && { stop_firewall; exit 2; } fi }