mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-25 12:13:29 +02:00
Resolve Optional/Required interfaces with wildcard names
Optional is allowed Required is not Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
165535cd8b
commit
82a74d7534
@ -845,7 +845,7 @@ sub handle_optional_interfaces() {
|
|||||||
|
|
||||||
my $returnvalue = verify_required_interfaces;
|
my $returnvalue = verify_required_interfaces;
|
||||||
|
|
||||||
my $interfaces = find_interfaces_by_option 'optional';
|
my $interfaces = find_interfaces_by_option1 'optional';
|
||||||
|
|
||||||
if ( @$interfaces ) {
|
if ( @$interfaces ) {
|
||||||
for my $interface ( @$interfaces ) {
|
for my $interface ( @$interfaces ) {
|
||||||
|
@ -67,6 +67,7 @@ our @EXPORT = qw( NOTHING
|
|||||||
source_port_to_bridge
|
source_port_to_bridge
|
||||||
interface_is_optional
|
interface_is_optional
|
||||||
find_interfaces_by_option
|
find_interfaces_by_option
|
||||||
|
find_interfaces_by_option1
|
||||||
get_interface_option
|
get_interface_option
|
||||||
set_interface_option
|
set_interface_option
|
||||||
verify_required_interfaces
|
verify_required_interfaces
|
||||||
@ -937,10 +938,10 @@ sub process_interface( $$ ) {
|
|||||||
$hostoptions{routeback} = $options{routeback} = 1;
|
$hostoptions{routeback} = $options{routeback} = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fatal_error "Optional and Required interfaces may not have wildcard names" if ( $wildcard || $physical =~ /\+/ ) && ( $options{optional} || $options{required} );
|
|
||||||
|
|
||||||
$hostoptions{routeback} = $options{routeback} = is_a_bridge( $physical ) unless $export || $options{routeback};
|
$hostoptions{routeback} = $options{routeback} = is_a_bridge( $physical ) unless $export || $options{routeback};
|
||||||
|
|
||||||
|
fatal_error "Required Interfaces may not have wildcard names ($physical)" if $options{required} && $physical =~ /\+/;
|
||||||
|
|
||||||
$hostoptionsref = \%hostoptions;
|
$hostoptionsref = \%hostoptions;
|
||||||
} else {
|
} else {
|
||||||
#
|
#
|
||||||
@ -1163,6 +1164,27 @@ sub find_interfaces_by_option( $ ) {
|
|||||||
\@ints;
|
\@ints;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Returns reference to array of interfaces with the passed option
|
||||||
|
#
|
||||||
|
sub find_interfaces_by_option1( $ ) {
|
||||||
|
my $option = $_[0];
|
||||||
|
my @ints = ();
|
||||||
|
|
||||||
|
for my $interface ( keys %interfaces ) {
|
||||||
|
my $interfaceref = $interfaces{$interface};
|
||||||
|
|
||||||
|
next if $interfaceref->{physical} =~ /\+/;
|
||||||
|
|
||||||
|
my $optionsref = $interfaceref->{options};
|
||||||
|
if ( $optionsref && defined $optionsref->{$option} ) {
|
||||||
|
push @ints , $interface
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
\@ints;
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return the value of an option for an interface
|
# Return the value of an option for an interface
|
||||||
#
|
#
|
||||||
@ -1303,8 +1325,6 @@ sub compile_updown() {
|
|||||||
if ( @$required ) {
|
if ( @$required ) {
|
||||||
my $interfaces = join '|', map $interfaces{$_}->{physical}, @$required;
|
my $interfaces = join '|', map $interfaces{$_}->{physical}, @$required;
|
||||||
|
|
||||||
$interfaces =~ s/\+/*/;
|
|
||||||
|
|
||||||
emit( "$interfaces)",
|
emit( "$interfaces)",
|
||||||
' if [ "$COMMAND" = up ]; then',
|
' if [ "$COMMAND" = up ]; then',
|
||||||
' COMMAND=start',
|
' COMMAND=start',
|
||||||
|
@ -14,7 +14,7 @@ Changes in Shorewall 4.4.10
|
|||||||
|
|
||||||
7) Rename PREFIX to DESTDIR in install scripts
|
7) Rename PREFIX to DESTDIR in install scripts
|
||||||
|
|
||||||
8) Optional/required interfaces with wildcard names disallowed.
|
8) Correct handling of optional/required interfaces with wildcard names.
|
||||||
|
|
||||||
Changes in Shorewall 4.4.9
|
Changes in Shorewall 4.4.9
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ I I I. P R O B L E M S C O R R E C T E D I N T H I S R E L E A S E
|
|||||||
|
|
||||||
The XYZTEL provider was never usable.
|
The XYZTEL provider was never usable.
|
||||||
|
|
||||||
This configuration now generates a compile-time error.
|
This configuration now works correctly.
|
||||||
|
|
||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
I V. K N O W N P R O B L E M S R E M A I N I N G
|
I V. K N O W N P R O B L E M S R E M A I N I N G
|
||||||
|
Loading…
x
Reference in New Issue
Block a user