Improve editing of ipset-based rules

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6922 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-07-21 15:35:45 +00:00
parent b721749a3e
commit a7e52291dd

View File

@ -1142,19 +1142,19 @@ sub get_set_flags( $$ ) {
my ( $setname, $option ) = @_;
my $options = $option;
fatal_error "Your kernel and/or iptables does not include ipset match ($setname)" unless $capabilities{IPSET_MATCH};
if ( $setname =~ /(.*)\[([1-6])\]$/ ) {
if ( $setname =~ /^(.*)\[([1-6])\]$/ ) {
$setname = $1;
my $count = $2;
$options .= ",$option" while --$count > 0;
} elsif ( $setname =~ /(.+)\[(.*)\]$/ ) {
} elsif ( $setname =~ /^(.*)\[(.*)\]$/ ) {
$setname = $1;
$options = $2;
}
$setname =~ s/^\+//;
fatal_error "Invalid ipset name ($setname)" unless $setname =~ /^[a-zA-Z]\w*/;
"--set $setname $options "
}
@ -1179,7 +1179,6 @@ sub match_source_net( $ ) {
} elsif ( $net =~ /^!/ ) {
$net =~ s/!//;
validate_net $net;
validate_net $net;
"-s ! $net ";
} else {
validate_net $net;