summaryrefslogtreecommitdiff
path: root/lib/Vyatta/SrcNatRule.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Vyatta/SrcNatRule.pm')
-rw-r--r--lib/Vyatta/SrcNatRule.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Vyatta/SrcNatRule.pm b/lib/Vyatta/SrcNatRule.pm
index 89623a4..52227a5 100644
--- a/lib/Vyatta/SrcNatRule.pm
+++ b/lib/Vyatta/SrcNatRule.pm
@@ -176,9 +176,11 @@ sub rule_str {
if (defined($self->{_proto})) {
my $str = $self->{_proto};
- my $negate ="";
- $negate = "!" if (m/^\!(.*)$/);
- $str =~ s/^\!(.*)$/ $1/;
+ my $negate = "";
+ 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