]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - html/cgi-bin/netexternal.cgi
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2005-2010 IPFire Team #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
23 use experimental
'smartmatch';
25 # enable only the following on debugging purpose
27 #use CGI::Carp 'fatalsToBrowser';
31 require '/var/ipfire/general-functions.pl';
32 require "${General::swroot}/lang.pl";
33 require "${General::swroot}/header.pl";
34 require "${General::swroot}/geoip-functions.pl";
35 require "${General::swroot}/graphs.pl";
37 # Libloc database handle.
38 my $libloc_db_handle = &GeoIP
::init
();
41 my %mainsettings = ();
43 &General
::readhash
("${General::swroot}/ethernet/settings", \
%netsettings);
44 &General
::readhash
("${General::swroot}/main/settings", \
%mainsettings);
45 &General
::readhash
("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \
%color);
50 my @querry = split(/\?/,$ENV{'QUERY_STRING'});
51 $querry[0] = '' unless defined $querry[0];
52 $querry[1] = 'hour' unless defined $querry[1];
54 if ( $querry[0] ne~ ""){
55 print "Content-type: image/png\n\n";
57 &Graphs
::updateifgraph
($querry[0],$querry[1]);
60 &Header
::showhttpheaders
();
61 &Header
::openpage
($Lang::tr
{'network traffic graphs external'}, 1, '');
62 &Header
::openbigbox
('100%', 'left');
64 if ($netsettings{'RED_TYPE'} ne 'PPPOE'){
65 if ($netsettings{'RED_DEV'} ne $netsettings{'GREEN_DEV'}){
66 push (@graphs, ($netsettings{'RED_DEV'}));
69 push (@graphs, "ppp0");
72 if (-e
"/var/log/rrd/collectd/localhost/interface/if_octets-ipsec0.rrd"){
73 push (@graphs, ("ipsec0"));
76 if (-e
"/var/log/rrd/collectd/localhost/interface/if_octets-tun0.rrd"){
77 push (@graphs, ("tun0"));
81 &Header
::openbox
('100%', 'center', "$_ $Lang::tr{'graph'}");
82 &Graphs
::makegraphbox
("netexternal.cgi",$_,"day");
86 if ( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $netsettings{'RED_TYPE'} eq "DHCP"){
88 &Header
::openbox
('100%', 'left', "RED $Lang::tr{'dhcp configuration'}");
89 if (-s
"${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info") {
91 &General
::readhash
("${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info", \
%dhcpinfo);
93 my $DNS1=`echo $dhcpinfo{'domain_name_servers'} | cut -f 1 -d " "`;
94 my $DNS2=`echo $dhcpinfo{'domain_name_servers'} | cut -f 2 -d " "`;
98 if ($dhcpinfo{'dhcp_lease_time'} ne "") {
99 $lsetme=$dhcpinfo{'dhcp_lease_time'};
100 $lsetme=($lsetme/60);
103 $lsetme=($lsetme/60); $leasetime=$lsetme." Hour";
105 $leasetime=$lsetme." Minute";
109 $leasetime=$leasetime."s";
116 if ($dhcpinfo{'dhcp_renewal_time'} ne "") {
117 $rentme=$dhcpinfo{'dhcp_renewal_time'};
118 $rentme=($rentme/60);
121 $rentme=($rentme/60); $rnwltime=$rentme." Hour";
123 $rnwltime=$rentme." Minute";
127 $rnwltime=$rnwltime."s";
134 if ($dhcpinfo{'dhcp_rebinding_time'} ne "") {
135 $maxtme=$dhcpinfo{'dhcp_rebinding_time'};
136 $maxtme=($maxtme/60);
139 $maxtme=($maxtme/60); $maxtime=$maxtme." Hour";
141 $maxtime=$maxtme." Minute";
145 $maxtime=$maxtime."s";
152 <tr><td width='30%'>$Lang::tr{'domain'}</td><td>$dhcpinfo{'domain_name'}</td></tr>
153 <tr><td>$Lang::tr{'gateway'}</td><td>$dhcpinfo{'routers'}</td></tr>
154 <tr><td>$Lang::tr{'primary dns'}</td><td>$DNS1</td></tr>
155 <tr><td>$Lang::tr{'secondary dns'}</td><td>$DNS2</td></tr>
156 <tr><td>$Lang::tr{'dhcp server'}</td><td>$dhcpinfo{'dhcp_server_identifier'}</td></tr>
157 <tr><td>$Lang::tr{'def lease time'}</td><td>$leasetime</td></tr>
158 <tr><td>$Lang::tr{'default renewal time'}</td><td>$rnwltime</td></tr>
159 <tr><td>$Lang::tr{'max renewal time'}</td><td>$maxtime</td></tr>
164 print "$Lang::tr{'no dhcp lease'}";
169 &Header
::closebigbox
();
170 &Header
::closepage
();