]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - html/cgi-bin/network.cgi
1843d796ba14d4c910441187781f30cafc9c1464
5 # This code is distributed under the terms of the GPL
7 # (c) The SmoothWall Team
13 # enable only the following on debugging purpose
15 use CGI
::Carp
'fatalsToBrowser';
17 require '/var/ipfire/general-functions.pl';
18 require "${General::swroot}/lang.pl";
19 require "${General::swroot}/header.pl";
20 require "${General::swroot}/graphs.pl";
32 &Header
::showhttpheaders
();
34 &General
::readhash
("${General::swroot}/ethernet/settings", \
%netsettings);
36 $ENV{'QUERY_STRING'} =~ s/&//g;
37 @cgiparams = split(/network=/,$ENV{'QUERY_STRING'});
38 $cgiparams[1] = '' unless defined $cgiparams[1];
40 if ($cgiparams[1] =~ /red/) {
41 &Header
::openpage
($Lang::tr
{'network traffic graphs external'}, 1, '');
42 push (@graphs, ("RED"));
43 push (@graphs, ('lq'));
45 &Header
::openpage
($Lang::tr
{'network traffic graphs internal'}, 1, '');
46 push (@graphs, ('GREEN'));
47 if ($netsettings{'BLUE_DEV'}) {
48 push (@graphs, ('BLUE')); }
49 if ($netsettings{'ORANGE_DEV'}) {
50 push (@graphs, ('ORANGE')); }
53 &Header
::openbigbox
('100%', 'left');
55 foreach my $graphname (@graphs) {
57 if ($graphname == "lq" )
59 &Graphs
::updatelqgraph
("day");
60 &Graphs
::updatelqgraph
("week");
61 &Graphs
::updatelqgraph
("month");
62 &Graphs
::updatelqgraph
("year");
66 &Graphs
::updateifgraph
($graphname, "day");
67 &Graphs
::updateifgraph
($graphname, "week");
68 &Graphs
::updateifgraph
($graphname, "month");
69 &Graphs
::updateifgraph
($graphname, "year");
72 &Header
::openbox
('100%', 'center', "$graphname $Lang::tr{'graph'}");
73 if (-e
"$Header::graphdir/${graphname}-day.png") {
74 my $ftime = localtime((stat("$Header::graphdir/${graphname}-day.png"))[9]);
75 print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
76 print "<a href='/cgi-bin/graphs.cgi?graph=$graphname'>";
77 print "<img alt='' src='/graphs/${graphname}-day.png' border='0' />";
80 print $Lang::tr
{'no information available'};
86 if ($cgiparams[1] =~ /red/) {
88 if ( $netsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/ && $netsettings{'RED_TYPE'} eq "DHCP") {
90 &Header
::openbox
('100%', 'left', "RED $Lang::tr{'dhcp configuration'}");
91 if (-s
"${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info") {
93 &General
::readhash
("${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info", \
%dhcpinfo);
95 my $DNS1=`echo $dhcpinfo{'DNS'} | cut -f 1 -d ,`;
96 my $DNS2=`echo $dhcpinfo{'DNS'} | cut -f 2 -d ,`;
100 if ($dhcpinfo{'LEASETIME'} ne "") {
101 $lsetme=$dhcpinfo{'LEASETIME'};
102 $lsetme=($lsetme/60);
104 $lsetme=($lsetme/60); $leasetime=$lsetme." Hour";
106 $leasetime=$lsetme." Minute";
109 $leasetime=$leasetime."s";
114 if ($dhcpinfo{'RENEWALTIME'} ne "") {
115 $rentme=$dhcpinfo{'RENEWALTIME'};
116 $rentme=($rentme/60);
118 $rentme=($rentme/60); $rnwltime=$rentme." Hour";
120 $rnwltime=$rentme." Minute";
123 $rnwltime=$rnwltime."s";
128 if ($dhcpinfo{'REBINDTIME'} ne "") {
129 $maxtme=$dhcpinfo{'REBINDTIME'};
130 $maxtme=($maxtme/60);
132 $maxtme=($maxtme/60); $maxtime=$maxtme." Hour";
134 $maxtime=$maxtme." Minute";
137 $maxtime=$maxtime."s";
141 print "<table width='100%'>";
142 if ($dhcpinfo{'HOSTNAME'}) {
143 print "<tr><td width='30%'>$Lang::tr{'hostname'}</td><td>$dhcpinfo{'HOSTNAME'}.$dhcpinfo{'DOMAIN'}</td></tr>\n";
145 print "<tr><td width='30%'>$Lang::tr{'domain'}</td><td>$dhcpinfo{'DOMAIN'}</td></tr>\n";
148 <tr><td>$Lang::tr{'gateway'}</td><td>$dhcpinfo{'GATEWAY'}</td></tr>
149 <tr><td>$Lang::tr{'primary dns'}</td><td>$DNS1</td></tr>
150 <tr><td>$Lang::tr{'secondary dns'}</td><td>$DNS2</td></tr>
151 <tr><td>$Lang::tr{'dhcp server'}</td><td>$dhcpinfo{'DHCPSIADDR'}</td></tr>
152 <tr><td>$Lang::tr{'def lease time'}</td><td>$leasetime</td></tr>
153 <tr><td>$Lang::tr{'default renewal time'}</td><td>$rnwltime</td></tr>
154 <tr><td>$Lang::tr{'max renewal time'}</td><td>$maxtime</td></tr>
161 print "$Lang::tr{'no dhcp lease'}";
166 if ($dhcpsettings{'ENABLE_GREEN'} eq 'on' || $dhcpsettings{'ENABLE_BLUE'} eq 'on') {
167 &Header
::CheckSortOrder
;
168 &Header
::PrintActualLeases
;
173 &Header
::openbox
('100%', 'left', $Lang::tr
{'routing table entries'});
174 $output = `/sbin/ip route show`;
175 $output = &Header
::cleanhtml
($output,"y");
176 print "<pre>$output</pre>\n";
179 &Header
::openbox
('100%', 'left', $Lang::tr
{'arp table entries'});
180 $output = `/sbin/ip neigh show`;
181 $output = &Header
::cleanhtml
($output,"y");
182 print "<pre>$output</pre>\n";
187 &Header
::closebigbox
();
188 &Header
::closepage
();