summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2008-02-01 19:13:18 -0800
committerAn-Cheng Huang <ancheng@vyatta.com>2008-02-01 19:13:18 -0800
commit21b09233076a75bed7cd31177a5f52af40f572f9 (patch)
tree6e601e3a5abd2bcb5f74cfc0cc4a7475ce0c99f0 /scripts
parentbdc9858374b41b9d622dcea386a4b4bb82becbe0 (diff)
downloadvyatta-nat-21b09233076a75bed7cd31177a5f52af40f572f9.tar.gz
vyatta-nat-21b09233076a75bed7cd31177a5f52af40f572f9.zip
fix for bug 2528: collapse source/destination "address" and "network".
Diffstat (limited to 'scripts')
-rw-r--r--scripts/VyattaNatRule.pm33
1 files changed, 28 insertions, 5 deletions
diff --git a/scripts/VyattaNatRule.pm b/scripts/VyattaNatRule.pm
index 1daa336..e7316c0 100644
--- a/scripts/VyattaNatRule.pm
+++ b/scripts/VyattaNatRule.pm
@@ -81,8 +81,14 @@ sub setup {
$self->{_proto} = $config->returnValue("protocol");
$self->{_exclude} = $config->exists("exclude");
+ $self->{_source}->{_net} = undef;
$self->{_source}->{_addr} = $config->returnValue("source address");
- $self->{_source}->{_net} = $config->returnValue("source network");
+ if (defined($self->{_source}->{_addr})
+ && ($self->{_source}->{_addr} =~ /\//)) {
+ $self->{_source}->{_net} = $self->{_source}->{_addr};
+ $self->{_source}->{_addr} = undef;
+ }
+
my @tmp = $config->returnValues("source port-number");
$self->{_source}->{_port_num} = [ @tmp ];
@tmp = $config->returnValues("source port-name");
@@ -92,8 +98,14 @@ sub setup {
$self->{_source}->{_port_range}->{_stop}
= $config->returnValue("source port-range stop");
+ $self->{_destination}->{_net} = undef;
$self->{_destination}->{_addr} = $config->returnValue("destination address");
- $self->{_destination}->{_net} = $config->returnValue("destination network");
+ if (defined($self->{_destination}->{_addr})
+ && ($self->{_destination}->{_addr} =~ /\//)) {
+ $self->{_destination}->{_net} = $self->{_destination}->{_addr};
+ $self->{_destination}->{_addr} = undef;
+ }
+
@tmp = $config->returnValues("destination port-number");
$self->{_destination}->{_port_num} = [ @tmp ];
@tmp = $config->returnValues("destination port-name");
@@ -145,8 +157,14 @@ sub setupOrig {
$self->{_proto} = $config->returnOrigValue("protocol");
$self->{_exclude} = $config->existsOrig("exclude");
+ $self->{_source}->{_net} = undef;
$self->{_source}->{_addr} = $config->returnOrigValue("source address");
- $self->{_source}->{_net} = $config->returnOrigValue("source network");
+ if (defined($self->{_source}->{_addr})
+ && ($self->{_source}->{_addr} =~ /\//)) {
+ $self->{_source}->{_net} = $self->{_source}->{_addr};
+ $self->{_source}->{_addr} = undef;
+ }
+
my @tmp = $config->returnOrigValues("source port-number");
$self->{_source}->{_port_num} = [ @tmp ];
@tmp = $config->returnOrigValues("source port-name");
@@ -156,10 +174,15 @@ sub setupOrig {
$self->{_source}->{_port_range}->{_stop}
= $config->returnOrigValue("source port-range stop");
+ $self->{_destination}->{_net} = undef;
$self->{_destination}->{_addr}
= $config->returnOrigValue("destination address");
- $self->{_destination}->{_net}
- = $config->returnOrigValue("destination network");
+ if (defined($self->{_destination}->{_addr})
+ && ($self->{_destination}->{_addr} =~ /\//)) {
+ $self->{_destination}->{_net} = $self->{_destination}->{_addr};
+ $self->{_destination}->{_addr} = undef;
+ }
+
@tmp = $config->returnOrigValues("destination port-number");
$self->{_destination}->{_port_num} = [ @tmp ];
@tmp = $config->returnOrigValues("destination port-name");