diff --git a/Shorewall/Perl/Shorewall/Compiler.pm b/Shorewall/Perl/Shorewall/Compiler.pm index 67c6282d2..a3a08975d 100644 --- a/Shorewall/Perl/Shorewall/Compiler.pm +++ b/Shorewall/Perl/Shorewall/Compiler.pm @@ -313,9 +313,9 @@ sub generate_script_2() { if ( $global_variables == ( ALL_COMMANDS | NOT_RESTORE ) ) { + verify_required_interfaces(0); set_global_variables(0, 0); - - handle_optional_interfaces(0); + handle_optional_interfaces; } emit ';;'; @@ -327,19 +327,21 @@ sub generate_script_2() { push_indent; } + verify_required_interfaces(1); set_global_variables(1,1); if ( $global_variables & NOT_RESTORE ) { - handle_optional_interfaces(1); + handle_optional_interfaces; emit ';;'; pop_indent; pop_indent; emit ( 'esac' ); } else { - handle_optional_interfaces(1); + handle_optional_interfaces; } } else { - emit( 'true' ) unless handle_optional_interfaces(1); + verify_required_interfaces(1); + emit( 'true' ) unless handle_optional_interfaces; } pop_indent; diff --git a/Shorewall/Perl/Shorewall/Providers.pm b/Shorewall/Perl/Shorewall/Providers.pm index 30fb9be79..a4ae0f6ee 100644 --- a/Shorewall/Perl/Shorewall/Providers.pm +++ b/Shorewall/Perl/Shorewall/Providers.pm @@ -2195,17 +2195,13 @@ sub provider_realm( $ ) { } # -# This function is called by the compiler when it is generating the detect_configuration() function. -# The function calls Shorewall::Zones::verify_required_interfaces then emits code to set the -# ..._IS_USABLE interface variables appropriately for the optional interfaces +# Perform processing related to optional interfaces. Returns true if there are optional interfaces. + # -# Returns true if there were required or optional interfaces -# -sub handle_optional_interfaces( $ ) { +sub handle_optional_interfaces() { my @interfaces; my $wildcards; - # # First do the provider interfacess. Those that are real providers will never have wildcard physical # names but they might derive from wildcard interface entries. Optional interfaces which do not have @@ -2229,10 +2225,6 @@ sub handle_optional_interfaces( $ ) { if ( @interfaces ) { my $require = $config{REQUIRE_INTERFACE}; - my $gencase = shift; - - verify_required_interfaces( $gencase ); - emit '' if $gencase; emit( 'HAVE_INTERFACE=', '' ) if $require; # @@ -2396,8 +2388,6 @@ sub handle_optional_interfaces( $ ) { return 1; } - - verify_required_interfaces( shift ); } # diff --git a/Shorewall/Perl/Shorewall/Zones.pm b/Shorewall/Perl/Shorewall/Zones.pm index 44bd46f2a..fde6876f1 100644 --- a/Shorewall/Perl/Shorewall/Zones.pm +++ b/Shorewall/Perl/Shorewall/Zones.pm @@ -2021,6 +2021,7 @@ sub verify_required_interfaces( $ ) { emit( "esac\n" ); + $returnvalue = 1; } $interfaces = find_interfaces_by_option( 'required' ); @@ -2066,7 +2067,7 @@ sub verify_required_interfaces( $ ) { emit( ';;' ); pop_indent; pop_indent; - emit( 'esac' ); + emit( "esac\n" ); } $returnvalue = 1;