diff --git a/Shorewall-perl/Shorewall/Interfaces.pm b/Shorewall-perl/Shorewall/Interfaces.pm index 374957db9..f4be3d8e1 100644 --- a/Shorewall-perl/Shorewall/Interfaces.pm +++ b/Shorewall-perl/Shorewall/Interfaces.pm @@ -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; diff --git a/Shorewall-perl/Shorewall/Rules.pm b/Shorewall-perl/Shorewall/Rules.pm index df7396380..4e35e314f 100644 --- a/Shorewall-perl/Shorewall/Rules.pm +++ b/Shorewall-perl/Shorewall/Rules.pm @@ -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 )};