summaryrefslogtreecommitdiff
path: root/lib/Vyatta/IpTables
diff options
context:
space:
mode:
authorMarian Tudosoiu <marian.tudosoiu@1and1.ro>2018-04-11 11:13:14 +0300
committerMarian Tudosoiu <marian.tudosoiu@1and1.ro>2018-04-11 11:13:14 +0300
commitf6e4c60702f810cc06449782f64c7e5a7e20abb2 (patch)
treee2ae9f6a4394890060d7a20763656b61df64d46f /lib/Vyatta/IpTables
parentfc5e3b8bb61690619ee739f11cac54abb689d5f2 (diff)
downloadvyatta-cfg-firewall-f6e4c60702f810cc06449782f64c7e5a7e20abb2.tar.gz
vyatta-cfg-firewall-f6e4c60702f810cc06449782f64c7e5a7e20abb2.zip
Task T35 - fixing prune_deleted_sets for inet6 family
Diffstat (limited to 'lib/Vyatta/IpTables')
-rwxr-xr-xlib/Vyatta/IpTables/IpSet.pm19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/Vyatta/IpTables/IpSet.pm b/lib/Vyatta/IpTables/IpSet.pm
index ba5e68d..276b845 100755
--- a/lib/Vyatta/IpTables/IpSet.pm
+++ b/lib/Vyatta/IpTables/IpSet.pm
@@ -137,6 +137,25 @@ sub get_type {
return $self->{_type};
}
+sub get_family {
+ my ($self) = @_;
+ return $self->{_family} if defined $self->{_family};
+ return if !$self->exists();
+ my @lines = `ipset -L $self->{_name}`;
+ my $family;
+ foreach my $line (@lines) {
+ if ($line =~ /^Header: family (\w+) hashsize/) {
+ $family = $1;
+ $self->{_family} = $family;
+ last;
+ } elsif ($line =~ /^Type: bitmap:port$/){
+ $self->{_family} = "inet";
+ last;
+ }
+ }
+ return $self->{_family};
+}
+
sub alphanum_split {
my ($str) = @_;
my @list = split m/(?=(?<=\D)\d|(?<=\d)\D)/, $str;