Reverse order of required-interface and address variable processing

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2018-01-28 13:10:44 -08:00
parent 09cda21dd4
commit 230ab06e5d
3 changed files with 12 additions and 19 deletions

View File

@ -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;

View File

@ -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 );
}
#

View File

@ -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;