mirror of
https://gitlab.com/shorewall/code.git
synced 2025-01-18 03:29:12 +01:00
Allow '-' in the interface for dynamic zone.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
a12f1f9fbb
commit
b68b34b820
@ -891,8 +891,14 @@ sub is_a_bridge( $ ) {
|
|||||||
#
|
#
|
||||||
# Transform the passed interface name into a legal shell variable name.
|
# Transform the passed interface name into a legal shell variable name.
|
||||||
#
|
#
|
||||||
sub chain_base($) {
|
sub unclean_name( $$ ) {
|
||||||
my $chain = $_[0];
|
my ( $name, $allow_cash ) = @_;
|
||||||
|
|
||||||
|
$allow_cash ? $name =~ /[^-\w]/ : $name =~ /[^\w]/;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub chain_base($;$) {
|
||||||
|
my ( $chain, $allow_dash ) = @_;
|
||||||
my $name = $basemap{$chain};
|
my $name = $basemap{$chain};
|
||||||
#
|
#
|
||||||
# Return existing mapping, if any
|
# Return existing mapping, if any
|
||||||
@ -908,7 +914,7 @@ sub chain_base($) {
|
|||||||
$chain =~ s/\+$//;
|
$chain =~ s/\+$//;
|
||||||
$chain =~ tr/./_/;
|
$chain =~ tr/./_/;
|
||||||
|
|
||||||
if ( $chain eq '' || $chain =~ /^[0-9]/ || $chain =~ /[^\w]/ ) {
|
if ( $chain eq '' || $chain =~ /^[0-9]/ || unclean_name( $chain, $allow_cash ) ) {
|
||||||
#
|
#
|
||||||
# Must map. Remove all illegal characters
|
# Must map. Remove all illegal characters
|
||||||
#
|
#
|
||||||
@ -1855,7 +1861,7 @@ sub process_host( ) {
|
|||||||
if ( $hosts eq 'dynamic' ) {
|
if ( $hosts eq 'dynamic' ) {
|
||||||
fatal_error "Vserver zones may not be dynamic" if $type & VSERVER;
|
fatal_error "Vserver zones may not be dynamic" if $type & VSERVER;
|
||||||
require_capability( 'IPSET_MATCH', 'Dynamic nets', '');
|
require_capability( 'IPSET_MATCH', 'Dynamic nets', '');
|
||||||
my $physical = chain_base( physical_name $interface );
|
my $physical = chain_base( physical_name $interface , 1 );
|
||||||
my $set = $family == F_IPV4 ? "${zone}_${physical}" : "6_${zone}_${physical}";
|
my $set = $family == F_IPV4 ? "${zone}_${physical}" : "6_${zone}_${physical}";
|
||||||
$hosts = "+$set";
|
$hosts = "+$set";
|
||||||
$optionsref->{dynamic} = 1;
|
$optionsref->{dynamic} = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user