From 63b477a4de97a7cb6fc8663373368ce39c4b1583 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Thu, 10 Sep 2020 15:59:33 -0700 Subject: [PATCH] Clean up ALL_ACASTS generation Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Zones.pm | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Zones.pm b/Shorewall/Perl/Shorewall/Zones.pm index c6e18d7a0..aa1710026 100644 --- a/Shorewall/Perl/Shorewall/Zones.pm +++ b/Shorewall/Perl/Shorewall/Zones.pm @@ -1375,7 +1375,7 @@ sub process_interface( $$ ) { $hostoptions{$option} = $value if $hostopt; } elsif ( $type == ENUM_IF_OPTION ) { if ( $option eq 'arp_ignore' ) { - fatal_error q(The 'arp_ignore' option may not be used with a wild-card interface name) if $wildcard; + fatal_error q(The 'arp_ignore' option may not be used with a wild-card interface name) if $physwild; if ( defined $value ) { if ( $value =~ /^[1-3,8]$/ ) { $options{arp_ignore} = $value; @@ -2402,7 +2402,10 @@ sub generate_all_acasts() { my $interfaceref = $interfaces{$interface}; my $physical = $interfaceref->{physical}; - if ( $interfaceref->{wildcard} ) { + next if ( $interfaceref->{options}{port} || + $interfaceref->{options}{unmanaged} ); + + if ( $interfaceref->{physwild} ) { $physical =~ s/\+/*/; if ( $interfaceref->{options}{omitanycast} ) { @@ -2469,17 +2472,20 @@ sub generate_all_acasts() { emit( join( '|', @wildnoacasts) . ')', ' ;;' ); + } else { @wildacasts = ( '*' ); } - emit( join( '|', @wildacasts ) . ')', - ' if [ -n "$ALL_ACASTS" ]; then', - ' ALL_ACASTS="$ALL_ACASTS $(get_interface_acasts $iface)"', - ' else', - ' ALL_ACASTS="$(get_interface_acasts $iface)"', - ' fi', - ' ;;' ); + if ( @wildacasts ) { + emit( join( '|', @wildacasts ) . ')', + ' if [ -n "$ALL_ACASTS" ]; then', + ' ALL_ACASTS="$ALL_ACASTS $(get_interface_acasts $iface)"', + ' else', + ' ALL_ACASTS="$(get_interface_acasts $iface)"', + ' fi', + ' ;;' ); + } pop_indent; emit( 'esac');