mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-19 17:28:35 +02:00
Fix shell-variable creation
This commit is contained in:
parent
d8846b92d8
commit
3a36a9de4b
@ -163,8 +163,10 @@ our %interfaces;
|
|||||||
our @bport_zones;
|
our @bport_zones;
|
||||||
our %ipsets;
|
our %ipsets;
|
||||||
our %physical;
|
our %physical;
|
||||||
|
our %basemap;
|
||||||
our $family;
|
our $family;
|
||||||
our $have_ipsec;
|
our $have_ipsec;
|
||||||
|
our $baseseq;
|
||||||
|
|
||||||
use constant { FIREWALL => 1,
|
use constant { FIREWALL => 1,
|
||||||
IP => 2,
|
IP => 2,
|
||||||
@ -217,6 +219,8 @@ sub initialize( $ ) {
|
|||||||
@bport_zones = ();
|
@bport_zones = ();
|
||||||
%ipsets = ();
|
%ipsets = ();
|
||||||
%physical = ();
|
%physical = ();
|
||||||
|
%basemap = ();
|
||||||
|
$baseseq = 0;
|
||||||
|
|
||||||
if ( $family == F_IPV4 ) {
|
if ( $family == F_IPV4 ) {
|
||||||
%validinterfaceoptions = (arp_filter => BINARY_IF_OPTION,
|
%validinterfaceoptions = (arp_filter => BINARY_IF_OPTION,
|
||||||
@ -771,11 +775,32 @@ sub is_a_bridge( $ ) {
|
|||||||
#
|
#
|
||||||
sub chain_base($) {
|
sub chain_base($) {
|
||||||
my $chain = $_[0];
|
my $chain = $_[0];
|
||||||
|
#
|
||||||
$chain =~ s/^@/at_/;
|
# Handle VLANs and wildcards
|
||||||
$chain =~ tr/[.\-%@]/_/;
|
#
|
||||||
$chain =~ s/\+$//;
|
$chain =~ s/\+$//;
|
||||||
$chain;
|
$chain =~ tr/./_/;
|
||||||
|
|
||||||
|
if ( $chain =~ /^[0-9]/ || $chain =~ /[^\w]/ ) {
|
||||||
|
#
|
||||||
|
# Not valid variable name
|
||||||
|
#
|
||||||
|
if ( $basemap{$_[0]} ) {
|
||||||
|
#
|
||||||
|
# We've mapped this name previously
|
||||||
|
#
|
||||||
|
$basemap{$_[0]};
|
||||||
|
} else {
|
||||||
|
#
|
||||||
|
# Must map. Remove all illegal characters
|
||||||
|
#
|
||||||
|
$chain =~ s/[^\w]//g;
|
||||||
|
$chain = join( '' , 'if_', $chain ) unless $chain =~ /^[a-zA-z]/;
|
||||||
|
$basemap{$_[0]} = join ( '_', $chain, ++$baseseq );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$chain;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user