diff options
author | John Southworth <john.southworth@vyatta.com> | 2012-06-18 14:48:51 -0700 |
---|---|---|
committer | John Southworth <john.southworth@vyatta.com> | 2012-06-18 14:48:51 -0700 |
commit | ddd422acb40f41ba994a05a3a369c5788ceed07c (patch) | |
tree | 0f6d6fb0353e3d2f5f0a8bb5381b05ceb13c16b5 | |
parent | 91c6ed6d70832cd8c2c1f2dc3033dce67ca141aa (diff) | |
download | vyatta-nat-ddd422acb40f41ba994a05a3a369c5788ceed07c.tar.gz vyatta-nat-ddd422acb40f41ba994a05a3a369c5788ceed07c.zip |
Bugfix 8113: make negations work properly
-rw-r--r-- | lib/Vyatta/DstNatRule.pm | 4 | ||||
-rw-r--r-- | lib/Vyatta/SrcNatRule.pm | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/Vyatta/DstNatRule.pm b/lib/Vyatta/DstNatRule.pm index b8145cc..627fc16 100644 --- a/lib/Vyatta/DstNatRule.pm +++ b/lib/Vyatta/DstNatRule.pm @@ -157,12 +157,14 @@ sub rule_str { if (defined($self->{_proto})) { my $str = $self->{_proto}; + my $negate =""; + $negate = "!" if (m/^\!(.*)$/); $str =~ s/^\!(.*)$/ $1/; if ($str eq 'tcp_udp') { $tcp_and_udp = 1; $rule_str .= " -p tcp "; # we'll add the '-p udp' to 2nd rule later } else { - $rule_str .= " ! -p $str "; + $rule_str .= " $negate -p $str "; } } diff --git a/lib/Vyatta/SrcNatRule.pm b/lib/Vyatta/SrcNatRule.pm index 77bad83..1fdc383 100644 --- a/lib/Vyatta/SrcNatRule.pm +++ b/lib/Vyatta/SrcNatRule.pm @@ -176,12 +176,14 @@ sub rule_str { if (defined($self->{_proto})) { my $str = $self->{_proto}; + my $negate =""; + $negate = "!" if (m/^\!(.*)$/); $str =~ s/^\!(.*)$/ $1/; if ($str eq 'tcp_udp') { $tcp_and_udp = 1; $rule_str .= " -p tcp "; # we'll add the '-p udp' to 2nd rule later } else { - $rule_str .= " ! -p $str "; + $rule_str .= " $negate -p $str "; } } |