Fix edge case involving 'optional' and 'detectnets'

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6483 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-06-07 22:23:17 +00:00
parent 88bfa62395
commit 469de8bbb4
2 changed files with 18 additions and 1 deletions

View File

@ -42,6 +42,7 @@ our @EXPORT = qw( add_group_to_zone
interface_is_optional
find_interfaces_by_option
get_interface_option
clear_interface_option
@interfaces );
our @EXPORT_OK = ();
@ -435,4 +436,13 @@ sub get_interface_option( $$ ) {
$interfaces{$interface}{options}{$option};
}
#
# Clear an option for an interface
#
sub clear_interface_option( $$ ) {
my ( $interface, $option ) = @_;
delete $interfaces{$interface}{options}{$option};
}
1;

View File

@ -714,7 +714,14 @@ sub setup_mac_lists( $ ) {
fatal_error "Invalid DISPOSITION ( $disposition)" if ( $table eq 'mangle' ) && ! $targetref->{mangle};
fatal_error "No hosts on $interface have the maclist option specified" unless $maclist_interfaces{$interface};
unless ( $maclist_interfaces{$interface} ) {
if ( get_interface_option( $interface, 'optional' ) && get_interface_option( $interface, 'detectnets' ) ) {
clear_interface_option( $interface, 'maclist' );
next;
}
fatal_error "No hosts on $interface have the maclist option specified";
}
my $chainref = $chain_table{$table}{( $ttl ? macrecent_target $interface : mac_chain $interface )};