X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=html%2Fcgi-bin%2Fnetovpnsrv.cgi;h=a53090f0f09a9fdc1eace5b6d8906692b122876a;hb=c4391a0181b5bff0ac2db8efcdcefc9e20c3e098;hp=15a95b6b9f7e063627484836482b5e19fd3a0d73;hpb=9acda8fa69b22f410b2b3787b7fad5cff899488d;p=people%2Fpmueller%2Fipfire-2.x.git diff --git a/html/cgi-bin/netovpnsrv.cgi b/html/cgi-bin/netovpnsrv.cgi index 15a95b6b9f..a53090f0f0 100755 --- a/html/cgi-bin/netovpnsrv.cgi +++ b/html/cgi-bin/netovpnsrv.cgi @@ -33,10 +33,22 @@ require "${General::swroot}/graphs.pl"; my %color = (); my %mainsettings = (); &General::readhash("${General::swroot}/main/settings", \%mainsettings); -&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); +&General::readhash("/srv/web/ipfire/html/themes/ipfire/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,10 +72,16 @@ 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", "ipsec-$ipsecgraphs{$name}", "day"); + &Header::closebox(); + } + foreach (@vpns) { &Header::openbox('100%', 'center', "$_ $Lang::tr{'graph'}"); - &Graphs::makegraphbox("netovpnsrv.cgi",$_, "day",320); + &Graphs::makegraphbox("netovpnsrv.cgi",$_, "day"); &Header::closebox(); } }else{