summaryrefslogtreecommitdiff
path: root/lib/Vyatta/IpTables/Rule.pm
diff options
context:
space:
mode:
authorBob Gilligan <gilligan@vyatta.com>2009-01-23 13:59:37 -0800
committerBob Gilligan <gilligan@vyatta.com>2009-01-23 13:59:37 -0800
commit1f1d31163c347ace7b8e288363235ea22651916f (patch)
tree4584133fd8cce13f6c742a994812117f600056b9 /lib/Vyatta/IpTables/Rule.pm
parentdd37fdecea527c8d7098e257bc83e620af1ff730 (diff)
downloadvyatta-cfg-firewall-1f1d31163c347ace7b8e288363235ea22651916f.tar.gz
vyatta-cfg-firewall-1f1d31163c347ace7b8e288363235ea22651916f.zip
Bugfix 4062: Don't reference parameters outside the config tree.
The AddressFilter module was reaching up the config tree to find a config parameter that was used to determine whether the address type was IPv4 or IPv6. This breaks when the functions are called from some locations in the config tree. I added explicity function calls to allow the caller to to set the IP version, obviating the need to reference a config parameter to determin the IP version.
Diffstat (limited to 'lib/Vyatta/IpTables/Rule.pm')
-rw-r--r--lib/Vyatta/IpTables/Rule.pm14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Vyatta/IpTables/Rule.pm b/lib/Vyatta/IpTables/Rule.pm
index 449b32b..d55cf64 100644
--- a/lib/Vyatta/IpTables/Rule.pm
+++ b/lib/Vyatta/IpTables/Rule.pm
@@ -51,6 +51,7 @@ my %fields = (
_burst => undef,
},
_disable => undef,
+ _ip_version => undef,
);
my %dummy_rule = (
@@ -97,6 +98,7 @@ my %dummy_rule = (
_burst => undef,
},
_disable => undef,
+ _ip_version => undef,
);
sub new {
@@ -171,6 +173,8 @@ sub setup {
$src->setup("$level source");
$dst->setup("$level destination");
+ # Default to IPv4
+ $self->{_ip_version} = "ipv4";
return 0;
}
@@ -229,9 +233,19 @@ sub setupOrig {
$src->setupOrig("$level source");
$dst->setupOrig("$level destination");
+ # Default to IPv4
+ $self->{_ip_version} = "ipv4";
return 0;
}
+sub set_ip_version {
+ my ($self, $ip_version) = @_;
+
+ $self->{_ip_version} = $ip_version;
+ $src->set_ip_version($ip_version);
+ $dst->set_ip_version($ip_version);
+}
+
sub print {
my ( $self ) = @_;