summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2008-11-03 18:30:18 -0800
committerAn-Cheng Huang <ancheng@vyatta.com>2008-11-03 18:30:18 -0800
commite01c7f37a29ccc3e8a660c3c9995fd077948cc5d (patch)
tree1103b427d3dcb234ccb236bb5cc8ea016885561a /scripts
parent69153fc9f6dcaa59e95847214fbab18f43992682 (diff)
downloadvyatta-nat-e01c7f37a29ccc3e8a660c3c9995fd077948cc5d.tar.gz
vyatta-nat-e01c7f37a29ccc3e8a660c3c9995fd077948cc5d.zip
fix for bug 3717: enforce interface restrictions
Diffstat (limited to 'scripts')
-rw-r--r--scripts/VyattaNatRule.pm11
1 files changed, 8 insertions, 3 deletions
diff --git a/scripts/VyattaNatRule.pm b/scripts/VyattaNatRule.pm
index a5a96ae..a648035 100644
--- a/scripts/VyattaNatRule.pm
+++ b/scripts/VyattaNatRule.pm
@@ -148,6 +148,10 @@ sub rule_str {
$can_use_port = 0;
}
if (($self->{_type} eq "source") || ($self->{_type} eq "masquerade")) {
+ return (undef, 'cannot specify inbound interface with '
+ . '"masquerade" or "source" rules')
+ if (defined($self->{_inbound_if}));
+
if ($self->{_exclude}) {
$rule_str .= "-j RETURN";
} elsif ($self->{_type} eq "masquerade") {
@@ -186,9 +190,6 @@ sub rule_str {
$to_src .= "$start-$stop";
}
- return (undef, 'cannot specify inbound interface with "masquerade"')
- if (defined($self->{_inbound_if}) && ($self->{_type} eq "masquerade"));
-
if (($to_src ne "") && ($self->{_type} eq "masquerade")) {
return (undef, "cannot specify outside IP address with \"masquerade\"");
}
@@ -227,6 +228,10 @@ sub rule_str {
}
} elsif ($self->{_type} eq "destination") {
# type is destination
+ return (undef,
+ 'cannot specify outbound interface with "destination" rules')
+ if (defined($self->{_outbound_if}));
+
if ($self->{_exclude}) {
$rule_str .= "-j RETURN";
} else {