]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - html/cgi-bin/network.cgi
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";
31 &Header
::showhttpheaders
();
33 &General
::readhash
("${General::swroot}/ethernet/settings", \
%netsettings);
35 $ENV{'QUERY_STRING'} =~ s/&//g;
36 @cgiparams = split(/network=/,$ENV{'QUERY_STRING'});
37 $cgiparams[1] = '' unless defined $cgiparams[1];
39 if ($cgiparams[1] =~ /red/) {
40 &Header
::openpage
($Lang::tr
{'network traffic graphs external'}, 1, '');
41 push (@graphs, ("RED"));
42 push (@graphs, ('lq'));
44 &Header
::openpage
($Lang::tr
{'network traffic graphs internal'}, 1, '');
45 push (@graphs, ('GREEN'));
46 if ($netsettings{'BLUE_DEV'}) {
47 push (@graphs, ('BLUE')); }
48 if ($netsettings{'ORANGE_DEV'}) {
49 push (@graphs, ('ORANGE')); }
52 &Header
::openbigbox
('100%', 'left');
54 foreach my $graphname (@graphs) {
56 &Header
::openbox
('100%', 'center', "$graphname $Lang::tr{'graph'}");
57 if (-e
"$Header::graphdir/${graphname}-day.png") {
58 my $ftime = localtime((stat("$Header::graphdir/${graphname}-day.png"))[9]);
59 print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
60 print "<a href='/cgi-bin/graphs.cgi?graph=$graphname'>";
61 print "<img alt='' src='/graphs/${graphname}-day.png' border='0' />";
64 print $Lang::tr
{'no information available'};
70 if ($cgiparams[1] =~ /red/) {
72 if ( $netsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/ && $netsettings{'RED_TYPE'} eq "DHCP") {
74 &Header
::openbox
('100%', 'left', "RED $Lang::tr{'dhcp configuration'}");
75 if (-s
"${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info") {
77 &General
::readhash
("${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info", \
%dhcpinfo);
79 my $DNS1=`echo $dhcpinfo{'DNS'} | cut -f 1 -d ,`;
80 my $DNS2=`echo $dhcpinfo{'DNS'} | cut -f 2 -d ,`;
84 if ($dhcpinfo{'LEASETIME'} ne "") {
85 $lsetme=$dhcpinfo{'LEASETIME'};
88 $lsetme=($lsetme/60); $leasetime=$lsetme." Hour";
90 $leasetime=$lsetme." Minute";
93 $leasetime=$leasetime."s";
98 if ($dhcpinfo{'RENEWALTIME'} ne "") {
99 $rentme=$dhcpinfo{'RENEWALTIME'};
100 $rentme=($rentme/60);
102 $rentme=($rentme/60); $rnwltime=$rentme." Hour";
104 $rnwltime=$rentme." Minute";
107 $rnwltime=$rnwltime."s";
112 if ($dhcpinfo{'REBINDTIME'} ne "") {
113 $maxtme=$dhcpinfo{'REBINDTIME'};
114 $maxtme=($maxtme/60);
116 $maxtme=($maxtme/60); $maxtime=$maxtme." Hour";
118 $maxtime=$maxtme." Minute";
121 $maxtime=$maxtime."s";
125 print "<table width='100%'>";
126 if ($dhcpinfo{'HOSTNAME'}) {
127 print "<tr><td width='30%'>$Lang::tr{'hostname'}</td><td>$dhcpinfo{'HOSTNAME'}.$dhcpinfo{'DOMAIN'}</td></tr>\n";
129 print "<tr><td width='30%'>$Lang::tr{'domain'}</td><td>$dhcpinfo{'DOMAIN'}</td></tr>\n";
132 <tr><td>$Lang::tr{'gateway'}</td><td>$dhcpinfo{'GATEWAY'}</td></tr>
133 <tr><td>$Lang::tr{'primary dns'}</td><td>$DNS1</td></tr>
134 <tr><td>$Lang::tr{'secondary dns'}</td><td>$DNS2</td></tr>
135 <tr><td>$Lang::tr{'dhcp server'}</td><td>$dhcpinfo{'DHCPSIADDR'}</td></tr>
136 <tr><td>$Lang::tr{'def lease time'}</td><td>$leasetime</td></tr>
137 <tr><td>$Lang::tr{'default renewal time'}</td><td>$rnwltime</td></tr>
138 <tr><td>$Lang::tr{'max renewal time'}</td><td>$maxtime</td></tr>
145 print "$Lang::tr{'no dhcp lease'}";
150 if ($dhcpsettings{'ENABLE_GREEN'} eq 'on' || $dhcpsettings{'ENABLE_BLUE'} eq 'on') {
151 &Header
::CheckSortOrder
;
152 &Header
::PrintActualLeases
;
157 &Header
::openbox
('100%', 'left', $Lang::tr
{'routing table entries'});
158 $output = `/sbin/ip route show`;
159 $output = &Header
::cleanhtml
($output,"y");
160 print "<pre>$output</pre>\n";
163 &Header
::openbox
('100%', 'left', $Lang::tr
{'arp table entries'});
164 $output = `/sbin/ip neigh show`;
165 $output = &Header
::cleanhtml
($output,"y");
166 print "<pre>$output</pre>\n";
171 &Header
::closebigbox
();
172 &Header
::closepage
();