From ddd422acb40f41ba994a05a3a369c5788ceed07c Mon Sep 17 00:00:00 2001 From: John Southworth Date: Mon, 18 Jun 2012 14:48:51 -0700 Subject: Bugfix 8113: make negations work properly --- lib/Vyatta/DstNatRule.pm | 4 +++- lib/Vyatta/SrcNatRule.pm | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') 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 "; } } -- cgit v1.2.3