]>
git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - html/cgi-bin/network.cgi
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007 Michael Tremer & Christian Schmidt #
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 ###############################################################################
24 # enable only the following on debugging purpose
26 #use CGI::Carp 'fatalsToBrowser';
28 require '/var/ipfire/general-functions.pl';
29 require "${General::swroot}/lang.pl";
30 require "${General::swroot}/header.pl";
31 require "${General::swroot}/graphs.pl";
43 &Header
::showhttpheaders
();
45 &General
::readhash
("${General::swroot}/ethernet/settings", \
%netsettings);
47 $ENV{'QUERY_STRING'} =~ s/&//g;
48 @cgiparams = split(/network=/,$ENV{'QUERY_STRING'});
49 $cgiparams[1] = '' unless defined $cgiparams[1];
51 if ($cgiparams[1] =~ /red/) {
52 &Header
::openpage
($Lang::tr
{'network traffic graphs external'}, 1, '');
53 push (@graphs, ("RED"));
54 push (@graphs, ('lq'));
56 &Header
::openpage
($Lang::tr
{'network traffic graphs internal'}, 1, '');
57 push (@graphs, ('GREEN'));
58 if ($netsettings{'BLUE_DEV'}) {
59 push (@graphs, ('BLUE')); }
60 if ($netsettings{'ORANGE_DEV'}) {
61 push (@graphs, ('ORANGE')); }
64 &Header
::openbigbox
('100%', 'left');
66 foreach my $graphname (@graphs) {
68 if ($graphname eq "lq" )
69 { &Graphs
::updatelqgraph
("day"); }
71 { &Graphs
::updateifgraph
($graphname, "day"); }
73 &Header
::openbox
('100%', 'center', "$graphname $Lang::tr{'graph'}");
74 if (-e
"$Header::graphdir/${graphname}-day.png") {
75 my $ftime = localtime((stat("$Header::graphdir/${graphname}-day.png"))[9]);
76 print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
77 print "<a href='/cgi-bin/graphs.cgi?graph=$graphname'>";
78 print "<img alt='' src='/graphs/${graphname}-day.png' border='0' />";
81 print $Lang::tr
{'no information available'};
87 if ($cgiparams[1] =~ /red/) {
89 if ( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $netsettings{'RED_TYPE'} eq "DHCP") {
91 &Header
::openbox
('100%', 'left', "RED $Lang::tr{'dhcp configuration'}");
92 if (-s
"${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info") {
94 &General
::readhash
("${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info", \
%dhcpinfo);
96 my $DNS1=`echo $dhcpinfo{'DNS'} | cut -f 1 -d ,`;
97 my $DNS2=`echo $dhcpinfo{'DNS'} | cut -f 2 -d ,`;
101 if ($dhcpinfo{'LEASETIME'} ne "") {
102 $lsetme=$dhcpinfo{'LEASETIME'};
103 $lsetme=($lsetme/60);
105 $lsetme=($lsetme/60); $leasetime=$lsetme." Hour";
107 $leasetime=$lsetme." Minute";
110 $leasetime=$leasetime."s";
115 if ($dhcpinfo{'RENEWALTIME'} ne "") {
116 $rentme=$dhcpinfo{'RENEWALTIME'};
117 $rentme=($rentme/60);
119 $rentme=($rentme/60); $rnwltime=$rentme." Hour";
121 $rnwltime=$rentme." Minute";
124 $rnwltime=$rnwltime."s";
129 if ($dhcpinfo{'REBINDTIME'} ne "") {
130 $maxtme=$dhcpinfo{'REBINDTIME'};
131 $maxtme=($maxtme/60);
133 $maxtme=($maxtme/60); $maxtime=$maxtme." Hour";
135 $maxtime=$maxtme." Minute";
138 $maxtime=$maxtime."s";
142 print "<table width='100%'>";
143 if ($dhcpinfo{'HOSTNAME'}) {
144 print "<tr><td width='30%'>$Lang::tr{'hostname'}</td><td>$dhcpinfo{'HOSTNAME'}.$dhcpinfo{'DOMAIN'}</td></tr>\n";
146 print "<tr><td width='30%'>$Lang::tr{'domain'}</td><td>$dhcpinfo{'DOMAIN'}</td></tr>\n";
149 <tr><td>$Lang::tr{'gateway'}</td><td>$dhcpinfo{'GATEWAY'}</td></tr>
150 <tr><td>$Lang::tr{'primary dns'}</td><td>$DNS1</td></tr>
151 <tr><td>$Lang::tr{'secondary dns'}</td><td>$DNS2</td></tr>
152 <tr><td>$Lang::tr{'dhcp server'}</td><td>$dhcpinfo{'DHCPSIADDR'}</td></tr>
153 <tr><td>$Lang::tr{'def lease time'}</td><td>$leasetime</td></tr>
154 <tr><td>$Lang::tr{'default renewal time'}</td><td>$rnwltime</td></tr>
155 <tr><td>$Lang::tr{'max renewal time'}</td><td>$maxtime</td></tr>
162 print "$Lang::tr{'no dhcp lease'}";
167 if ($dhcpsettings{'ENABLE_GREEN'} eq 'on' || $dhcpsettings{'ENABLE_BLUE'} eq 'on') {
168 &Header
::CheckSortOrder
;
169 &Header
::PrintActualLeases
;
174 &Header
::openbox
('100%', 'left', $Lang::tr
{'routing table entries'});
175 $output = `/sbin/ip route show`;
176 $output = &Header
::cleanhtml
($output,"y");
177 print "<pre>$output</pre>\n";
180 &Header
::openbox
('100%', 'left', $Lang::tr
{'arp table entries'});
181 $output = `/sbin/ip neigh show`;
182 $output = &Header
::cleanhtml
($output,"y");
183 print "<pre>$output</pre>\n";
188 &Header
::closebigbox
();
189 &Header
::closepage
();