From 671e5ac94f792005bee5eccf459b5ead72caa816 Mon Sep 17 00:00:00 2001 From: teastep Date: Tue, 29 Aug 2006 16:26:04 +0000 Subject: [PATCH] A little cleanup of messages git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@4476 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall/functions | 6 +++++- Shorewall/lib.nat | 36 +++++++++++++++++++----------------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/Shorewall/functions b/Shorewall/functions index cdeeb9552..f12f034ac 100644 --- a/Shorewall/functions +++ b/Shorewall/functions @@ -1781,7 +1781,11 @@ lib_avail() # $1 = Name of the Library } # -# Strip the passed file. Return success if a) the stripped file is non-empty; or b) the library had been previously loaded +# Strip the passed file. +# +# Return success if +# a) the stripped file is non-empty and the library was successfully loaded; or +# b) the stripped file is empty but the library had been loaded previously # strip_file_and_lib_load() # $1 = logical file name, $2 = library to load if the stripped file is non-empty { diff --git a/Shorewall/lib.nat b/Shorewall/lib.nat index 6dd20b7d0..0ef6fbacb 100644 --- a/Shorewall/lib.nat +++ b/Shorewall/lib.nat @@ -418,19 +418,19 @@ __EOF__ } - if [ -n "$NAT_ENABLED" ]; then + if [ -s $TMP_DIR/masq ]; then progress_message2 "$DOING Masquerading/SNAT" save_progress_message "Setting up Masquerading/SNAT..." - fi - while read fullinterface networks addresses proto ports ipsec; do - expandv fullinterface networks addresses proto ports ipsec - if [ -n "$NAT_ENABLED" ]; then - setup_one - else - error_message "WARNING: NAT disabled; masq rule ignored" - fi - done < $TMP_DIR/masq + while read fullinterface networks addresses proto ports ipsec; do + expandv fullinterface networks addresses proto ports ipsec + if [ -n "$NAT_ENABLED" ]; then + setup_one + else + error_message "WARNING: NAT disabled; masq rule ignored" + fi + done < $TMP_DIR/masq + fi } # @@ -500,15 +500,17 @@ setup_nat() { policyout="-m policy --pol none --dir out" fi - [ -n "$RETAIN_ALIASES" ] || save_progress_message "Setting up one-to-one NAT..." + if [ -s $TMP_DIR/nat ]; then + save_progress_message "Setting up one-to-one NAT..." - while read external interface internal allints localnat; do - expandv external interface internal allints localnat + while read external interface internal allints localnat; do + expandv external interface internal allints localnat + + do_one_nat - do_one_nat - - progress_message_and_save " Host $internal NAT $external on $interface" - done < $TMP_DIR/nat + progress_message_and_save " Host $internal NAT $external on $interface" + done < $TMP_DIR/nat + fi } #