Propagate super option to parents

This commit is contained in:
Tom Eastep 2009-07-29 15:33:47 -07:00
parent ff5e95b164
commit 489e09a4d7

View File

@ -323,6 +323,20 @@ sub parse_zone_option_list($$)
\%h; \%h;
} }
#
# Set the super option on the passed zoneref and propagate to its parents
#
sub set_super( $ );
sub set_super( $ ) {
my $zoneref = shift;
unless ( $zoneref->{options}{super} ) {
$zoneref->{options}{super} = 1;
set_super( $zones{$_} ) for @{$zoneref->{parents}};
}
}
# #
# Process a record in the zones file # Process a record in the zones file
# #
@ -349,19 +363,15 @@ sub process_zone( \$ ) {
fatal_error "Invalid zone name ($zone)" if $reservedName{$zone} || $zone =~ /^all2|2all$/; fatal_error "Invalid zone name ($zone)" if $reservedName{$zone} || $zone =~ /^all2|2all$/;
fatal_error( "Duplicate zone name ($zone)" ) if $zones{$zone}; fatal_error( "Duplicate zone name ($zone)" ) if $zones{$zone};
if ( $type =~ /ipv4/i ) { if ( $type =~ /ipv([46])?/i ) {
fatal_error "Invalid zone type ($type)" if $family == F_IPV6; fatal_error "Invalid zone type ($type)" if $1 && $1 != $family;
$type = IP;
$$ip = 1;
} elsif ( $type =~ /ipv6/i ) {
fatal_error "Invalid zone type ($type)" if $family == F_IPV4;
$type = IP; $type = IP;
$$ip = 1; $$ip = 1;
} elsif ( $type =~ /^ipsec([46])?$/i ) { } elsif ( $type =~ /^ipsec([46])?$/i ) {
fatal_error "Invalid zone type ($type)" if $1 && (($1 == 4 && $family == F_IPV6 ) || ( $1 == 6 && $family == F_IPV4 )); fatal_error "Invalid zone type ($type)" if $1 && $1 != $family;
$type = IPSEC; $type = IPSEC;
} elsif ( $type =~ /^bport([46])?$/i ) { } elsif ( $type =~ /^bport([46])?$/i ) {
fatal_error "Invalid zone type ($type)" if $1 && (( $1 == 4 && $family == F_IPV6 ) || ( $1 == 6 && $family == F_IPV4 )); fatal_error "Invalid zone type ($type)" if $1 && $1 != $family;
warning_message "Bridge Port zones should have a parent zone" unless @parents; warning_message "Bridge Port zones should have a parent zone" unless @parents;
$type = BPORT; $type = BPORT;
push @bport_zones, $zone; push @bport_zones, $zone;
@ -380,7 +390,9 @@ sub process_zone( \$ ) {
if ( $type eq IPSEC ) { if ( $type eq IPSEC ) {
for ( @parents ) { for ( @parents ) {
$zones{$_}{options}{super} = 1 unless $zones{$_}{type} eq IPSEC; unless ( $zones{$_}{type} == IPSEC ) {
set_super( $zones{$_} );
}
} }
} }