diff options
author | Mohit Mehta <mohit.mehta@vyatta.com> | 2009-02-05 13:46:33 -0800 |
---|---|---|
committer | Mohit Mehta <mohit.mehta@vyatta.com> | 2009-02-05 13:46:33 -0800 |
commit | 251e142fb8a454a6f2eaab8ebc85ab6e343098e1 (patch) | |
tree | 1889d173da1a54f518a775625e4e9093efd30eb1 | |
parent | 0c56b3c8ddc8a32a5408c5c1d86ac7b4bd089789 (diff) | |
download | vyatta-cfg-firewall-251e142fb8a454a6f2eaab8ebc85ab6e343098e1.tar.gz vyatta-cfg-firewall-251e142fb8a454a6f2eaab8ebc85ab6e343098e1.zip |
display appropriate anywhere address depending on IPv4 or IPv6
protocol should be displayed as all when no protocol set
-rwxr-xr-x | lib/Vyatta/IpTables/AddressFilter.pm | 8 | ||||
-rw-r--r-- | lib/Vyatta/IpTables/Rule.pm | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/Vyatta/IpTables/AddressFilter.pm b/lib/Vyatta/IpTables/AddressFilter.pm index 9f05664..d073e6b 100755 --- a/lib/Vyatta/IpTables/AddressFilter.pm +++ b/lib/Vyatta/IpTables/AddressFilter.pm @@ -255,6 +255,14 @@ sub outputXmlElem { sub outputXml { my ($self, $prefix, $fh) = @_; + if (!defined($self->{_address}) && !defined($self->{_network}) + && !defined($self->{_range_start}) && !defined($self->{_range_stop})) { + if (($self->{_ip_version} eq "ipv4")) { + $self->{_address} = "0.0.0.0/0"; + } else { + $self->{_address} = "::/0"; + } + } outputXmlElem("${prefix}_addr", $self->{_address}, $fh); outputXmlElem("${prefix}_net", $self->{_network}, $fh); outputXmlElem("${prefix}_addr_start", $self->{_range_start}, $fh); diff --git a/lib/Vyatta/IpTables/Rule.pm b/lib/Vyatta/IpTables/Rule.pm index 78b97e7..7575061 100644 --- a/lib/Vyatta/IpTables/Rule.pm +++ b/lib/Vyatta/IpTables/Rule.pm @@ -529,6 +529,9 @@ sub outputXmlElem { sub outputXml { my ($self, $fh) = @_; + if (!defined($self->{_protocol})) { + $self->{_protocol} = "all"; + } outputXmlElem("protocol", $self->{_protocol}, $fh); my $state_str = get_state_str($self); if ($state_str ne "") { |