mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 06:03:28 +00:00
Fix ipset display
This commit is contained in:
@@ -231,22 +231,19 @@ return $line;
|
||||
# return a list of active ipsets
|
||||
sub get_ipsets_active
|
||||
{
|
||||
local (@rv, $name, $set={});
|
||||
my (@rv, $name, $set);
|
||||
open(FILE, "ipset list -t 2>/dev/null |");
|
||||
LINE:
|
||||
while(<FILE>) {
|
||||
# remove newlines, get arg and value
|
||||
# remove newlines, get arg and value
|
||||
s/\r|\n//g;
|
||||
local ($n, $v) = split(/: /, $_);
|
||||
($n) = $n =~ /(\S+)/;
|
||||
# get values from name to number
|
||||
$name=$v if ($n eq "Name");
|
||||
$set->{$n}=$v;
|
||||
if ($n eq "Number") {
|
||||
push(@rv, $set);
|
||||
$set={};
|
||||
}
|
||||
}
|
||||
my ($n, $v) = split(/: /, $_);
|
||||
$n =~ s/^(\S+).*/$1/;
|
||||
if ($n eq "Name") {
|
||||
$set = { };
|
||||
push(@rv, $set);
|
||||
}
|
||||
$set->{$n} = $v;
|
||||
}
|
||||
return @rv;
|
||||
}
|
||||
|
||||
|
||||
@@ -437,21 +437,28 @@ else {
|
||||
if (@ipsets) {
|
||||
print &ui_hr();
|
||||
print "<b>$text{'index_ipset_title'}</b>";
|
||||
|
||||
# Generate the header
|
||||
local (@hcols, @tds);
|
||||
push(@hcols, $text{'index_ipset'}, "<b>$text{'index_ipset_name'}</b> ", $text{'index_ipset_type'},
|
||||
$text{'index_ipset_elem'}, $text{'index_ipset_maxe'}, $text{'index_ipset_size'});
|
||||
push(@tds, "", "", "", "", "");
|
||||
print &ui_columns_start(\@hcols, 100, 0, \@tds);
|
||||
@hcols = ( $text{'index_ipset'},
|
||||
$text{'index_ipset_name'},
|
||||
$text{'index_ipset_type'},
|
||||
$text{'index_ipset_elem'},
|
||||
$text{'index_ipset_maxe'},
|
||||
$text{'index_ipset_size'} );
|
||||
print &ui_columns_start(\@hcols, 100, 0);
|
||||
|
||||
# Generate a row for each rule
|
||||
foreach $s (@ipsets) {
|
||||
local @cols;
|
||||
local @h= split(/ /, $s->{'Header'});
|
||||
my @h = split(/ /, $s->{'Header'});
|
||||
# print matching pínet version
|
||||
if ($h[1] =~ /inet${ipvx}$/) {
|
||||
push(@cols, " $h[0] $h[1]", " <b>$s->{'Name'}</b>",
|
||||
$s->{'Type'}, $s->{'Number'}, $h[5], $s->{'Size'});
|
||||
print &ui_columns_row(\@cols, \@tds);
|
||||
my @cols = ( "$h[0] $h[1]",
|
||||
$s->{'Name'},
|
||||
$s->{'Type'},
|
||||
$s->{'Number'} || 0,
|
||||
$h[5],
|
||||
$s->{'Size'} );
|
||||
print &ui_columns_row(\@cols);
|
||||
}
|
||||
}
|
||||
print &ui_columns_end();
|
||||
|
||||
Reference in New Issue
Block a user