mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-26 10:52:57 +02:00
Add routed IPsec connections to traffic graphs section
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
@@ -35,8 +35,20 @@ my %mainsettings = ();
|
||||
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
|
||||
&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
|
||||
|
||||
my %vpnsettings = ();
|
||||
&General::readhasharray("${General::swroot}/vpn/config", \%vpnsettings);
|
||||
|
||||
my @vpns=();
|
||||
|
||||
# Make list of all IPsec graphs
|
||||
my %ipsecgraphs = ();
|
||||
foreach my $key (sort {$vpnsettings{$a}[1] <=> $vpnsettings{$b}[1]} keys %vpnsettings) {
|
||||
my $interface_mode = $vpnsettings{$key}[36];
|
||||
next unless ($interface_mode);
|
||||
|
||||
$ipsecgraphs{$vpnsettings{$key}[1]} = "${interface_mode}${key}";
|
||||
}
|
||||
|
||||
my @querry = split(/\?/,$ENV{'QUERY_STRING'});
|
||||
$querry[0] = '' unless defined $querry[0];
|
||||
$querry[1] = 'week' unless defined $querry[1];
|
||||
@@ -44,7 +56,11 @@ $querry[1] = 'week' unless defined $querry[1];
|
||||
if ( $querry[0] ne ""){
|
||||
print "Content-type: image/png\n\n";
|
||||
binmode(STDOUT);
|
||||
&Graphs::updatevpnn2ngraph($querry[0],$querry[1]);
|
||||
if (grep { $_ eq $querry[0] } values %ipsecgraphs) {
|
||||
&Graphs::updateifgraph($querry[0],$querry[1]);
|
||||
} else {
|
||||
&Graphs::updatevpnn2ngraph($querry[0],$querry[1]);
|
||||
}
|
||||
}else{
|
||||
&Header::showhttpheaders();
|
||||
&Header::openpage($Lang::tr{'vpn statistic n2n'}, 1, '');
|
||||
@@ -56,7 +72,13 @@ if ( $querry[0] ne ""){
|
||||
push(@vpns,$2);
|
||||
}
|
||||
}
|
||||
if (@vpns){
|
||||
if (@vpns || %ipsecgraphs) {
|
||||
foreach my $name (sort keys %ipsecgraphs) {
|
||||
&Header::openbox('100%', 'center', "$Lang::tr{'ipsec connection'}: $name");
|
||||
&Graphs::makegraphbox("netovpnsrv.cgi", $ipsecgraphs{$name}, "day");
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
foreach (@vpns) {
|
||||
&Header::openbox('100%', 'center', "$_ $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("netovpnsrv.cgi",$_, "day");
|
||||
|
||||
Reference in New Issue
Block a user