From 93db8120f9c456c9122001a09b1c78df8614f776 Mon Sep 17 00:00:00 2001 From: teastep Date: Tue, 1 Oct 2002 23:58:48 +0000 Subject: [PATCH] Some optimizations to the Dynamic Zone code git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@281 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall/firewall | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Shorewall/firewall b/Shorewall/firewall index 545459405..657bb987b 100755 --- a/Shorewall/firewall +++ b/Shorewall/firewall @@ -3451,6 +3451,14 @@ refresh_firewall() rm -rf $TMP_DIR } +################################################################################ +# Query NetFilter about the existence of a filter chain # +################################################################################ +chain_exists() # $1 = chain name +{ + qt iptables -L $1 -n +} + ################################################################################ # Add a host or subnet to a zone # ################################################################################ @@ -3458,11 +3466,6 @@ add_to_zone() # $1 = [:] $2 = zone { local base - chain_exists() # $1 = chain name - { - qt iptables -L $1 -n - } - nat_chain_exists() # $1 = chain name { qt iptables -t nat -L $1 -n @@ -3620,11 +3623,6 @@ add_to_zone() # $1 = [:] $2 = zone ################################################################################ delete_from_zone() # $1 = [:] $2 = zone { - chain_exists() # $1 = chain name - { - qt iptables -L $1 -n - } - delete_from_zones_file() { > ${STATEDIR}/zones_$$ @@ -3671,7 +3669,8 @@ delete_from_zone() # $1 = [:] $2 = zone delhost="$interface:$host" - [ -z "`delete_from_zones_file`" ] && startup_error "Error: $1 not in zone $2" + [ -z "`delete_from_zones_file`" ] && \ + error_message "Warning: $1 does not appear to be in zone $2" while read z hosts; do eval ${z}_hosts=\"$hosts\"