summaryrefslogtreecommitdiff
path: root/lib/Vyatta
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2009-06-15 18:07:12 -0700
committerStig Thormodsrud <stig@vyatta.com>2009-06-15 18:10:41 -0700
commitab23370a369bb999eba110b50423eb36136a1bcd (patch)
treedbe523136ff766c34f8adcd5b894b665cc139850 /lib/Vyatta
parent2715618badc802857ca005f329f45d5583588bd7 (diff)
downloadvyatta-cfg-firewall-ab23370a369bb999eba110b50423eb36136a1bcd.tar.gz
vyatta-cfg-firewall-ab23370a369bb999eba110b50423eb36136a1bcd.zip
Fix negate of firewall group.
Diffstat (limited to 'lib/Vyatta')
-rwxr-xr-xlib/Vyatta/IpTables/IpSet.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Vyatta/IpTables/IpSet.pm b/lib/Vyatta/IpTables/IpSet.pm
index 60ec2f2..a0038c2 100755
--- a/lib/Vyatta/IpTables/IpSet.pm
+++ b/lib/Vyatta/IpTables/IpSet.pm
@@ -37,6 +37,7 @@ my %fields = (
_name => undef,
_type => undef, # vyatta group type, not ipset type
_exists => undef,
+ _negate => undef,
_debug => undef,
);
@@ -61,6 +62,10 @@ sub new {
my $self = {
%fields,
};
+ if ($name =~ m/^!/) {
+ $self->{_negate} = 1;
+ $name =~ s/^!(.*)$/$1/;
+ }
$self->{_name} = $name;
$self->{_type} = $type;
@@ -402,6 +407,7 @@ sub get_firewall_references {
$config->setLevel($rule_path);
my $group_type = "$self->{_type}-group";
my $value = $config->returnOrigValue($group_type);
+ $value =~ s/^!(.*)$/$1/ if defined $value;
if (defined $value and $self->{_name} eq $value) {
push @fw_refs, "$name-$rule-$dir";
}
@@ -427,7 +433,9 @@ sub rule {
$srcdst = 'dst' if $direction eq 'destination';
return (undef, "Invalid direction [$direction]") if ! defined $srcdst;
- return (" -m set --set $grp $srcdst ", );
+ my $opt = '';
+ $opt = '!' if $self->{_negate};
+ return (" -m set $opt --set $grp $srcdst ", );
}
1;