diff --git a/Shorewall/Perl/Shorewall/Compiler.pm b/Shorewall/Perl/Shorewall/Compiler.pm index b61feffb4..878984218 100644 --- a/Shorewall/Perl/Shorewall/Compiler.pm +++ b/Shorewall/Perl/Shorewall/Compiler.pm @@ -101,7 +101,7 @@ EOF copy1 $lib, emit "\n" if -f $lib; - for my $exit qw/init isusable start tcclear started stop stopped clear refresh refreshed restored findgw/ { + for my $exit qw/init start tcclear started stop stopped clear refresh refreshed restored/ { emit "\nrun_${exit}_exit() {"; push_indent; append_file $exit or emit 'true'; @@ -109,6 +109,14 @@ EOF emit '}'; } + for my $exit qw/isusable findgw/ { + emit "\nrun_${exit}_exit() {"; + push_indent; + append_file($exit, 1) or emit 'true'; + pop_indent; + emit '}'; + } + emit <<'EOF'; ################################################################################ # End user exit functions diff --git a/Shorewall/Perl/Shorewall/Config.pm b/Shorewall/Perl/Shorewall/Config.pm index 37a588bd8..a44116d41 100644 --- a/Shorewall/Perl/Shorewall/Config.pm +++ b/Shorewall/Perl/Shorewall/Config.pm @@ -1051,6 +1051,8 @@ sub copy( $ ) { sub copy1( $ ) { assert( $object_enabled ); + my $result = 0; + if ( $object ) { my $file = $_[0]; @@ -1076,6 +1078,7 @@ sub copy1( $ ) { $do_indent = 0; print $object $_; print $object "\n"; + $result = 1; next; } @@ -1087,12 +1090,16 @@ sub copy1( $ ) { print $object $_; print $object "\n"; $do_indent = ! ( $here_documents || /\\$/ ); + + $result = 1 unless $result || /^\s*$/ || /^\s*#/; } close IF; } $lastlineblank = 0; + + $result; } # @@ -2481,17 +2488,27 @@ sub propagateconfig() { # # Add a shell script file to the output script -- Return true if the -# file exists and is not in /usr/share/shorewall/. +# file exists and is not in /usr/share/shorewall/ and is non-empty. # -sub append_file( $ ) { +sub append_file( $;$ ) { my $user_exit = find_file $_[0]; my $result = 0; unless ( $user_exit =~ /^($globals{SHAREDIR})/ ) { if ( -f $user_exit ) { - $result = 1; - save_progress_message "Processing $user_exit ..."; - copy1 $user_exit; + if ( $_[1] ) { + # + # Suppress progress message + # + $result = copy1 $user_exit; + } else { + # + # Include progress message -- Pretend progress_message call was in the file + # + $result = 1; + save_progress_message "Processing $user_exit ..."; + copy1 $user_exit; + } } } diff --git a/Shorewall/changelog.txt b/Shorewall/changelog.txt index b87e711de..9249f990d 100644 --- a/Shorewall/changelog.txt +++ b/Shorewall/changelog.txt @@ -1,4 +1,4 @@ -Changes in Shorewall 4.4.0-Beta3 +qChanges in Shorewall 4.4.0-Beta3 1) Add new macros. @@ -8,6 +8,8 @@ Changes in Shorewall 4.4.0-Beta3 4) Check for xt_LOG. +5) Fix 'findgw' + Changes in Shorewall 4.4.0-Beta2 1) The 'find_first_interface_address()' and diff --git a/Shorewall/releasenotes.txt b/Shorewall/releasenotes.txt index dfb0d5bb0..cd09195ec 100644 --- a/Shorewall/releasenotes.txt +++ b/Shorewall/releasenotes.txt @@ -130,6 +130,8 @@ Shorewall 4.4.0 Beta 3 shows the contents of the dynamic blacklist as in earlier Shorewall releases. +3) The 'findgw' script produced an error if VERBOSITY > 0. + ---------------------------------------------------------------------------- K N O W N P R O B L E M S R E M A I N I N G ----------------------------------------------------------------------------