summaryrefslogtreecommitdiff
path: root/lib/Vyatta/DstNatRule.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Vyatta/DstNatRule.pm')
-rw-r--r--lib/Vyatta/DstNatRule.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Vyatta/DstNatRule.pm b/lib/Vyatta/DstNatRule.pm
index e2aa483..bd54306 100644
--- a/lib/Vyatta/DstNatRule.pm
+++ b/lib/Vyatta/DstNatRule.pm
@@ -158,8 +158,10 @@ sub rule_str {
if (defined($self->{_proto})) {
my $str = $self->{_proto};
my $negate ="";
- $negate = "!" if (m/^\!(.*)$/);
- $str =~ s/^\!(.*)$/ $1/;
+ if ($str =~ /^\!(.*)$/) {
+ $str = $1;
+ $negate = "!";
+ }
if ($str eq 'tcp_udp') {
$tcp_and_udp = 1;
$rule_str .= " -p tcp "; # we'll add the '-p udp' to 2nd rule later