Rework handle_optional_interfaces() somewhat

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2010-08-30 12:29:39 -07:00
parent 8077c9e1c3
commit 7f0f4516d7
2 changed files with 14 additions and 13 deletions

View File

@ -845,14 +845,14 @@ sub lookup_provider( $ ) {
# #
sub handle_optional_interfaces( $ ) { sub handle_optional_interfaces( $ ) {
my $returnvalue = verify_required_interfaces( shift ); my ( $interfaces, $wildcards ) = find_interfaces_by_option1 'optional';
my $require = $config{REQUIRE_INTERFACE};
my $wildcards = 0;
my $interfaces = find_interfaces_by_option1 'optional', $wildcards;
emit( 'HAVE_INTERFACE=', '' ) if $require;
if ( @$interfaces ) { if ( @$interfaces ) {
my $require = $config{REQUIRE_INTERFACE};
verify_required_interfaces( shift );
emit( 'HAVE_INTERFACE=', '' ) if $require;
# #
# Clear the '_IS_USABLE' variables # Clear the '_IS_USABLE' variables
# #
@ -960,10 +960,10 @@ sub handle_optional_interfaces( $ ) {
); );
} }
$returnvalue = 1; return 1;
} }
$returnvalue; verify_required_interfaces( shift );
} }
# #

View File

@ -1292,10 +1292,10 @@ sub find_interfaces_by_option( $ ) {
# Returns reference to array of interfaces with the passed option. Unlike the preceding function, this one: # Returns reference to array of interfaces with the passed option. Unlike the preceding function, this one:
# #
# - All entries in %interfaces are searched. # - All entries in %interfaces are searched.
# - The second argument is used to return an indication of the presents of wildcard interfaces # - Returns a two-element list; the second element indicates whether any members of the list have wildcard physical names
# #
sub find_interfaces_by_option1( $\$ ) { sub find_interfaces_by_option1( $ ) {
my ( $option, $wildref) = @_; my $option = $_[0];
my @ints = (); my @ints = ();
my $wild = 0; my $wild = 0;
@ -1313,8 +1313,9 @@ sub find_interfaces_by_option1( $\$ ) {
} }
} }
$$wildref = $wild; return unless defined wantarray;
\@ints;
wantarray ? ( \@ints, $wild ) : \@ints;
} }
# #