diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2008-02-01 19:13:20 -0800 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2008-02-01 19:13:20 -0800 |
commit | 4658f6263d756066712e5c0be11a21e5dcc9d774 (patch) | |
tree | 17f4ca0e6c1f61b45c0217be7c9ecee79d2ce87e | |
parent | df59479b92a9ca1d20c6cebcd83b135f2aaf7761 (diff) | |
download | vyatta-cfg-firewall-4658f6263d756066712e5c0be11a21e5dcc9d774.tar.gz vyatta-cfg-firewall-4658f6263d756066712e5c0be11a21e5dcc9d774.zip |
fix for bug 2528: collapse source/destination "address" and "network".
5 files changed, 32 insertions, 12 deletions
diff --git a/scripts/firewall/VyattaIpTablesAddressFilter.pm b/scripts/firewall/VyattaIpTablesAddressFilter.pm index 4747e5e..aa65854 100644 --- a/scripts/firewall/VyattaIpTablesAddressFilter.pm +++ b/scripts/firewall/VyattaIpTablesAddressFilter.pm @@ -47,8 +47,12 @@ sub setup { # setup address filter nodes $self->{_range_start} = $config->returnValue("range start"); $self->{_range_stop} = $config->returnValue("range stop"); - $self->{_network} = $config->returnValue("network"); $self->{_address} = $config->returnValue("address"); + $self->{_network} = undef; + if (defined($self->{_address}) && ($self->{_address} =~ /\//)) { + $self->{_network} = $self->{_address}; + $self->{_address} = undef; + } my @tmp = $config->returnValues("port-number"); $self->{_portnumber} = [ @tmp ]; @tmp = $config->returnValues("port-name"); @@ -74,8 +78,12 @@ sub setupOrig { # setup address filter nodes $self->{_range_start} = $config->returnOrigValue("range start"); $self->{_range_stop} = $config->returnOrigValue("range stop"); - $self->{_network} = $config->returnOrigValue("network"); $self->{_address} = $config->returnOrigValue("address"); + $self->{_network} = undef; + if (defined($self->{_address}) && ($self->{_address} =~ /\//)) { + $self->{_network} = $self->{_address}; + $self->{_address} = undef; + } my @tmp = $config->returnOrigValues("port-number"); $self->{_portnumber} = [ @tmp ]; @tmp = $config->returnOrigValues("port-name"); diff --git a/templates/firewall/name/node.tag/rule/node.tag/destination/address/node.def b/templates/firewall/name/node.tag/rule/node.tag/destination/address/node.def index 61b702a..48da82b 100644 --- a/templates/firewall/name/node.tag/rule/node.tag/destination/address/node.def +++ b/templates/firewall/name/node.tag/rule/node.tag/destination/address/node.def @@ -1,3 +1,12 @@ type: txt -help: Configure firewall destination address -syntax:expression: exec "/opt/vyatta/sbin/vyatta-validate-type.pl ipv4_negate '$VAR(@)'" ; "invalid destination address \"$VAR(@)\"" +help: Destination address or subnet +syntax:expression: exec "/opt/vyatta/sbin/vyatta-validate-type.pl \ + -q ipv4_negate '$VAR(@)' \ + || /opt/vyatta/sbin/vyatta-validate-type.pl \ + -q ipv4net_negate '$VAR(@)'" \ + ; "invalid destination address \"$VAR(@)\"" +comp_help: Possible completions: + <IP address> IP address to match + <IP address>/<prefix length> Subnet to match + !<IP address> Match everything except the specified address + !<IP address>/<prefix length> Match everything except the specified subnet diff --git a/templates/firewall/name/node.tag/rule/node.tag/destination/network/node.def b/templates/firewall/name/node.tag/rule/node.tag/destination/network/node.def deleted file mode 100644 index 9d07028..0000000 --- a/templates/firewall/name/node.tag/rule/node.tag/destination/network/node.def +++ /dev/null @@ -1,3 +0,0 @@ -type: txt -help: Configure firewall destination network -syntax:expression: exec "/opt/vyatta/sbin/vyatta-validate-type.pl ipv4net_negate '$VAR(@)'" ; "invalid destination network \"$VAR(@)\"" diff --git a/templates/firewall/name/node.tag/rule/node.tag/source/address/node.def b/templates/firewall/name/node.tag/rule/node.tag/source/address/node.def index 9304fb2..a9dda73 100644 --- a/templates/firewall/name/node.tag/rule/node.tag/source/address/node.def +++ b/templates/firewall/name/node.tag/rule/node.tag/source/address/node.def @@ -1,3 +1,12 @@ type: txt -help: Configure firewall source address -syntax:expression: exec "/opt/vyatta/sbin/vyatta-validate-type.pl ipv4_negate '$VAR(@)'" ; "invalid source address \"$VAR(@)\"" +help: Source address or subnet +syntax:expression: exec "/opt/vyatta/sbin/vyatta-validate-type.pl \ + -q ipv4_negate '$VAR(@)' \ + || /opt/vyatta/sbin/vyatta-validate-type.pl \ + -q ipv4net_negate '$VAR(@)'" \ + ; "invalid source address \"$VAR(@)\"" +comp_help: Possible completions: + <IP address> IP address to match + <IP address>/<prefix length> Subnet to match + !<IP address> Match everything except the specified address + !<IP address>/<prefix length> Match everything except the specified subnet diff --git a/templates/firewall/name/node.tag/rule/node.tag/source/network/node.def b/templates/firewall/name/node.tag/rule/node.tag/source/network/node.def deleted file mode 100644 index 7c9e939..0000000 --- a/templates/firewall/name/node.tag/rule/node.tag/source/network/node.def +++ /dev/null @@ -1,3 +0,0 @@ -type: txt -help: Configure firewall source network -syntax:expression: exec "/opt/vyatta/sbin/vyatta-validate-type.pl ipv4net_negate '$VAR(@)'" ; "invalid source network \"$VAR(@)\"" |