]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - html/cgi-bin/netstatus.cgi
5 # This code is distributed under the terms of the GPL
7 # (c) The SmoothWall Team
12 # enable only the following on debugging purpose
14 #use CGI::Carp 'fatalsToBrowser';
16 require '/var/ipfire/general-functions.pl';
17 require "${General::swroot}/lang.pl";
18 require "${General::swroot}/header.pl";
26 &General
::readhash
("${General::swroot}/dhcp/settings", \
%dhcpsettings);
27 &General
::readhash
("${General::swroot}/ethernet/settings", \
%netsettings);
28 &General
::readhash
("${General::swroot}/ppp/settings", \
%pppsettings);
29 &Header
::showhttpheaders
();
30 &Header
::openpage
($Lang::tr
{'network status information'}, 1, '');
32 &Header
::openbigbox
('100%', 'left');
34 &Header
::openbox
('100%', 'left', $Lang::tr
{'interfaces'});
35 $output = `/sbin/ip addr show`;
36 $output = &Header
::cleanhtml
($output,"y");
38 my @itfs = ('ORANGE','BLUE','GREEN');
39 foreach my $itf (@itfs) {
42 my $dev = $netsettings{"${itf}_DEV"};
44 $ColorName = "${lc_itf}"; #dereference variable name...
45 $output =~ s/$dev/<b><font color="$ColorName">$dev<\/font
><\
/b>/ ;
49 if (open(REDIFACE
, "${General::swroot}/red/iface")) {
51 my $reddev = <REDIFACE
>;
54 $output =~ s/$reddev/<b><font color='red'>${reddev}<\/font
><\
/b>/;
56 print "<pre>$output</pre>\n";
60 if ( $netsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/ && $netsettings{'RED_TYPE'} eq "DHCP") {
62 print "<a name='reddhcp'/>\n";
63 &Header
::openbox
('100%', 'left', "RED $Lang::tr{'dhcp configuration'}");
64 if (-s
"${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info") {
66 &General
::readhash
("${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info", \
%dhcpinfo);
68 my $DNS1=`echo $dhcpinfo{'DNS'} | cut -f 1 -d ,`;
69 my $DNS2=`echo $dhcpinfo{'DNS'} | cut -f 2 -d ,`;
73 if ($dhcpinfo{'LEASETIME'} ne "") {
74 $lsetme=$dhcpinfo{'LEASETIME'};
77 $lsetme=($lsetme/60); $leasetime=$lsetme." Hour";
79 $leasetime=$lsetme." Minute";
82 $leasetime=$leasetime."s";
87 if ($dhcpinfo{'RENEWALTIME'} ne "") {
88 $rentme=$dhcpinfo{'RENEWALTIME'};
91 $rentme=($rentme/60); $rnwltime=$rentme." Hour";
93 $rnwltime=$rentme." Minute";
96 $rnwltime=$rnwltime."s";
101 if ($dhcpinfo{'REBINDTIME'} ne "") {
102 $maxtme=$dhcpinfo{'REBINDTIME'};
103 $maxtme=($maxtme/60);
105 $maxtme=($maxtme/60); $maxtime=$maxtme." Hour";
107 $maxtime=$maxtme." Minute";
110 $maxtime=$maxtime."s";
114 print "<table width='100%'>";
115 if ($dhcpinfo{'HOSTNAME'}) {
116 print "<tr><td width='30%'>$Lang::tr{'hostname'}</td><td>$dhcpinfo{'HOSTNAME'}.$dhcpinfo{'DOMAIN'}</td></tr>\n";
118 print "<tr><td width='30%'>$Lang::tr{'domain'}</td><td>$dhcpinfo{'DOMAIN'}</td></tr>\n";
121 <tr><td>$Lang::tr{'gateway'}</td><td>$dhcpinfo{'GATEWAY'}</td></tr>
122 <tr><td>$Lang::tr{'primary dns'}</td><td>$DNS1</td></tr>
123 <tr><td>$Lang::tr{'secondary dns'}</td><td>$DNS2</td></tr>
124 <tr><td>$Lang::tr{'dhcp server'}</td><td>$dhcpinfo{'DHCPSIADDR'}</td></tr>
125 <tr><td>$Lang::tr{'def lease time'}</td><td>$leasetime</td></tr>
126 <tr><td>$Lang::tr{'default renewal time'}</td><td>$rnwltime</td></tr>
127 <tr><td>$Lang::tr{'max renewal time'}</td><td>$maxtime</td></tr>
134 print "$Lang::tr{'no dhcp lease'}";
139 if ($dhcpsettings{'ENABLE_GREEN'} eq 'on' || $dhcpsettings{'ENABLE_BLUE'} eq 'on') {
141 print "<a name='leases'/>";
142 &Header
::CheckSortOrder
;
143 &Header
::PrintActualLeases
;
146 &Header
::openbox
('100%', 'left', $Lang::tr
{'routing table entries'});
147 $output = `/sbin/ip show show`;
148 $output = &Header
::cleanhtml
($output,"y");
149 print "<pre>$output</pre>\n";
152 &Header
::openbox
('100%', 'left', $Lang::tr
{'arp table entries'});
153 $output = `/sbin/ip neigh show`;
154 $output = &Header
::cleanhtml
($output,"y");
155 print "<pre>$output</pre>\n";
158 &Header
::closebigbox
();
160 &Header
::closepage
();