]>
git.ipfire.org Git - people/mfischer/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";
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 eq "lq" )
58 { &Graphs
::updatelqgraph
("day"); }
60 { &Graphs
::updateifgraph
($graphname, "day"); }
62 &Header
::openbox
('100%', 'center', "$graphname $Lang::tr{'graph'}");
63 if (-e
"$Header::graphdir/${graphname}-day.png") {
64 my $ftime = localtime((stat("$Header::graphdir/${graphname}-day.png"))[9]);
65 print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
66 print "<a href='/cgi-bin/graphs.cgi?graph=$graphname'>";
67 print "<img alt='' src='/graphs/${graphname}-day.png' border='0' />";
70 print $Lang::tr
{'no information available'};
76 if ($cgiparams[1] =~ /red/) {
78 if ( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $netsettings{'RED_TYPE'} eq "DHCP") {
80 &Header
::openbox
('100%', 'left', "RED $Lang::tr{'dhcp configuration'}");
81 if (-s
"${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info") {
83 &General
::readhash
("${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info", \
%dhcpinfo);
85 my $DNS1=`echo $dhcpinfo{'DNS'} | cut -f 1 -d ,`;
86 my $DNS2=`echo $dhcpinfo{'DNS'} | cut -f 2 -d ,`;
90 if ($dhcpinfo{'LEASETIME'} ne "") {
91 $lsetme=$dhcpinfo{'LEASETIME'};
94 $lsetme=($lsetme/60); $leasetime=$lsetme." Hour";
96 $leasetime=$lsetme." Minute";
99 $leasetime=$leasetime."s";
104 if ($dhcpinfo{'RENEWALTIME'} ne "") {
105 $rentme=$dhcpinfo{'RENEWALTIME'};
106 $rentme=($rentme/60);
108 $rentme=($rentme/60); $rnwltime=$rentme." Hour";
110 $rnwltime=$rentme." Minute";
113 $rnwltime=$rnwltime."s";
118 if ($dhcpinfo{'REBINDTIME'} ne "") {
119 $maxtme=$dhcpinfo{'REBINDTIME'};
120 $maxtme=($maxtme/60);
122 $maxtme=($maxtme/60); $maxtime=$maxtme." Hour";
124 $maxtime=$maxtme." Minute";
127 $maxtime=$maxtime."s";
131 print "<table width='100%'>";
132 if ($dhcpinfo{'HOSTNAME'}) {
133 print "<tr><td width='30%'>$Lang::tr{'hostname'}</td><td>$dhcpinfo{'HOSTNAME'}.$dhcpinfo{'DOMAIN'}</td></tr>\n";
135 print "<tr><td width='30%'>$Lang::tr{'domain'}</td><td>$dhcpinfo{'DOMAIN'}</td></tr>\n";
138 <tr><td>$Lang::tr{'gateway'}</td><td>$dhcpinfo{'GATEWAY'}</td></tr>
139 <tr><td>$Lang::tr{'primary dns'}</td><td>$DNS1</td></tr>
140 <tr><td>$Lang::tr{'secondary dns'}</td><td>$DNS2</td></tr>
141 <tr><td>$Lang::tr{'dhcp server'}</td><td>$dhcpinfo{'DHCPSIADDR'}</td></tr>
142 <tr><td>$Lang::tr{'def lease time'}</td><td>$leasetime</td></tr>
143 <tr><td>$Lang::tr{'default renewal time'}</td><td>$rnwltime</td></tr>
144 <tr><td>$Lang::tr{'max renewal time'}</td><td>$maxtime</td></tr>
151 print "$Lang::tr{'no dhcp lease'}";
156 if ($dhcpsettings{'ENABLE_GREEN'} eq 'on' || $dhcpsettings{'ENABLE_BLUE'} eq 'on') {
157 &Header
::CheckSortOrder
;
158 &Header
::PrintActualLeases
;
163 &Header
::openbox
('100%', 'left', $Lang::tr
{'routing table entries'});
164 $output = `/sbin/ip route show`;
165 $output = &Header
::cleanhtml
($output,"y");
166 print "<pre>$output</pre>\n";
169 &Header
::openbox
('100%', 'left', $Lang::tr
{'arp table entries'});
170 $output = `/sbin/ip neigh show`;
171 $output = &Header
::cleanhtml
($output,"y");
172 print "<pre>$output</pre>\n";
177 &Header
::closebigbox
();
178 &Header
::closepage
();