mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-27 11:13:24 +02:00
Merge remote-tracking branch 'ms/modem-status' into next
Conflicts: doc/language_issues.es doc/language_issues.fr doc/language_issues.nl doc/language_issues.pl doc/language_issues.ru doc/language_issues.tr doc/language_missings
This commit is contained in:
@@ -101,7 +101,7 @@ my @protocols;
|
||||
&General::readhasharray("$configipsec", \%ipsecconf);
|
||||
&Header::showhttpheaders();
|
||||
&Header::getcgihash(\%fwdfwsettings);
|
||||
&Header::openpage($Lang::tr{'fwdfw menu'}, 1, '');
|
||||
&Header::openpage($Lang::tr{'firewall rules'}, 1, '');
|
||||
&Header::openbigbox('100%', 'center',$errormessage);
|
||||
#### JAVA SCRIPT ####
|
||||
print<<END;
|
||||
@@ -1284,6 +1284,10 @@ sub get_serviceports
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Sort protocols alphabetically.
|
||||
@protocols = sort(@protocols);
|
||||
|
||||
return @protocols;
|
||||
}
|
||||
sub getcolor
|
||||
@@ -2295,8 +2299,8 @@ sub viewtablerule
|
||||
&General::readhash("/var/ipfire/ethernet/settings", \%netsettings);
|
||||
|
||||
&viewtablenew(\%configfwdfw, $configfwdfw, $Lang::tr{'firewall rules'});
|
||||
&viewtablenew(\%configinputfw, $configinput, $Lang::tr{'external access'});
|
||||
&viewtablenew(\%configoutgoingfw, $configoutgoing, $Lang::tr{'outgoing firewall'});
|
||||
&viewtablenew(\%configinputfw, $configinput, $Lang::tr{'incoming firewall access'});
|
||||
&viewtablenew(\%configoutgoingfw, $configoutgoing, $Lang::tr{'outgoing firewall access'});
|
||||
}
|
||||
sub viewtablenew
|
||||
{
|
||||
|
||||
@@ -1846,7 +1846,7 @@ sub viewtablegrp
|
||||
print "<td align='center' $col>$Lang::tr{'fwhost deleted'}</td><td align='center' $col>$customgrp{$key}[3]</td><td width='1%' $col><form method='post'>";
|
||||
}else{
|
||||
my ($colip,$colsub) = split("/",$ip);
|
||||
$ip="$colip/".&General::subtocidr($colsub) if ($colsub);
|
||||
$ip="$colip/".&General::iporsubtocidr($colsub) if ($colsub);
|
||||
print"<td align='center' $col>".&getcolor($ip)."</td><td align='center' $col>$customgrp{$key}[3]</td><td width='1%' $col><form method='post'>";
|
||||
}
|
||||
if ($delflag > 0 && $ip ne ''){
|
||||
|
||||
@@ -152,7 +152,7 @@ END
|
||||
|
||||
for(my $i = 1; $i <= $#iostat1; $i++){
|
||||
if ( $i eq '1' ){
|
||||
print "<tr><td align='center' class='boldbase'><b>$Lang::tr{'device'}</b></td><td align='center' class='boldbase'><b>$Lang::tr{'MB read'}</b></td><td align='center' class='boldbase'><b>$Lang::{'MB written'}</b></td></tr>";
|
||||
print "<tr><td align='center' class='boldbase'><b>$Lang::tr{'device'}</b></td><td align='center' class='boldbase'><b>$Lang::tr{'MB read'}</b></td><td align='center' class='boldbase'><b>$Lang::tr{'MB written'}</b></td></tr>";
|
||||
}else{
|
||||
print "<tr><td align='center'>$iostat1[$i]</td><td align='center'>$iostat2[$i]</td><td align='center'>$iostat3[$i]</td></tr>";
|
||||
}
|
||||
|
||||
211
html/cgi-bin/modem-status.cgi
Executable file
211
html/cgi-bin/modem-status.cgi
Executable file
@@ -0,0 +1,211 @@
|
||||
#!/usr/bin/perl
|
||||
###############################################################################
|
||||
# #
|
||||
# IPFire.org - A linux based firewall #
|
||||
# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation, either version 3 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
###############################################################################
|
||||
|
||||
use strict;
|
||||
|
||||
# enable only the following on debugging purpose
|
||||
use warnings;
|
||||
use CGI::Carp 'fatalsToBrowser';
|
||||
|
||||
require '/var/ipfire/general-functions.pl';
|
||||
require "${General::swroot}/lang.pl";
|
||||
require "${General::swroot}/header.pl";
|
||||
require "${General::swroot}/modem-lib.pl";
|
||||
|
||||
my $modem;
|
||||
my %ethsettings = {};
|
||||
my %pppsettings = {};
|
||||
|
||||
&General::readhash("${General::swroot}/ethernet/settings", \%ethsettings);
|
||||
|
||||
if ($ethsettings{"RED_TYPE"} eq "PPPOE") {
|
||||
&General::readhash("${General::swroot}/ppp/settings", \%pppsettings);
|
||||
|
||||
# Establish the connection to the modem.
|
||||
my $port = $pppsettings{'MONPORT'};
|
||||
if ($port) {
|
||||
$port = "/dev/$port";
|
||||
$modem = Modem->new($port, $pppsettings{"DTERATE"});
|
||||
}
|
||||
}
|
||||
|
||||
&Header::showhttpheaders();
|
||||
&Header::openpage($Lang::tr{'modem information'}, 1, '');
|
||||
&Header::openbigbox('100%', 'left');
|
||||
|
||||
if ($modem) {
|
||||
&Header::openbox("100%", "center", $Lang::tr{'modem hardware details'});
|
||||
|
||||
print <<END;
|
||||
<table width="100%">
|
||||
<tbody>
|
||||
END
|
||||
|
||||
my $vendor = $modem->get_vendor();
|
||||
if ($vendor) {
|
||||
print <<END;
|
||||
<tr>
|
||||
<td width="33%">$Lang::tr{'vendor'}</td>
|
||||
<td>$vendor</td>
|
||||
</tr>
|
||||
END
|
||||
}
|
||||
|
||||
my $model = $modem->get_model();
|
||||
if ($model) {
|
||||
print <<END;
|
||||
<tr>
|
||||
<td width="33%">$Lang::tr{'model'}</td>
|
||||
<td>$model</td>
|
||||
</tr>
|
||||
END
|
||||
}
|
||||
|
||||
my $software_version = $modem->get_software_version();
|
||||
if ($software_version) {
|
||||
print <<END;
|
||||
<tr>
|
||||
<td width="33%">$Lang::tr{'software version'}</td>
|
||||
<td>$software_version</td>
|
||||
</tr>
|
||||
END
|
||||
}
|
||||
|
||||
my $imei = $modem->get_imei();
|
||||
if ($imei) {
|
||||
print <<END;
|
||||
<tr>
|
||||
<td width="33%">$Lang::tr{'imei'}</td>
|
||||
<td>$imei</td>
|
||||
</tr>
|
||||
END
|
||||
}
|
||||
|
||||
my @caps = $modem->get_capabilities();
|
||||
if (@caps) {
|
||||
my $caps_string = join(", ", @caps);
|
||||
|
||||
print <<END;
|
||||
<tr>
|
||||
<td width="33%">$Lang::tr{'capabilities'}</td>
|
||||
<td>$caps_string</td>
|
||||
</tr>
|
||||
END
|
||||
}
|
||||
|
||||
print <<END;
|
||||
</tbody>
|
||||
</table>
|
||||
END
|
||||
&Header::closebox();
|
||||
|
||||
|
||||
&Header::openbox("100%", "center", $Lang::tr{'modem sim information'});
|
||||
print <<END;
|
||||
<table width="100%">
|
||||
<tbody>
|
||||
END
|
||||
|
||||
my $imsi = $modem->get_sim_imsi();
|
||||
if ($imsi) {
|
||||
print <<END;
|
||||
<tr>
|
||||
<td width="33%">$Lang::tr{'imsi'}</td>
|
||||
<td>$imsi</td>
|
||||
</tr>
|
||||
END
|
||||
}
|
||||
|
||||
print <<END;
|
||||
</tbody>
|
||||
</table>
|
||||
END
|
||||
&Header::closebox();
|
||||
|
||||
&Header::openbox("100%", "center", $Lang::tr{'modem network information'});
|
||||
print <<END;
|
||||
<table width="100%">
|
||||
<tbody>
|
||||
END
|
||||
|
||||
my $network_registration = $modem->get_network_registration();
|
||||
if ($network_registration) {
|
||||
print <<END;
|
||||
<tr>
|
||||
<td width="33%">$Lang::tr{'modem network registration'}</td>
|
||||
<td>$network_registration</td>
|
||||
</tr>
|
||||
END
|
||||
}
|
||||
|
||||
my $network_operator = $modem->get_network_operator();
|
||||
if ($network_operator) {
|
||||
print <<END;
|
||||
<tr>
|
||||
<td width="33%">$Lang::tr{'modem network operator'}</td>
|
||||
<td>$network_operator</td>
|
||||
</tr>
|
||||
END
|
||||
}
|
||||
|
||||
my $network_mode = $modem->get_network_mode();
|
||||
if ($network_mode) {
|
||||
print <<END;
|
||||
<tr>
|
||||
<td width="33%">$Lang::tr{'modem network mode'}</td>
|
||||
<td>$network_mode</td>
|
||||
</tr>
|
||||
END
|
||||
}
|
||||
|
||||
my $signal_quality = $modem->get_signal_quality();
|
||||
if ($signal_quality) {
|
||||
print <<END;
|
||||
<tr>
|
||||
<td width="33%">$Lang::tr{'modem network signal quality'}</td>
|
||||
<td>$signal_quality dBm</td>
|
||||
</tr>
|
||||
END
|
||||
}
|
||||
|
||||
my $bit_error_rate = $modem->get_bit_error_rate();
|
||||
if ($bit_error_rate) {
|
||||
print <<END;
|
||||
<tr>
|
||||
<td width="33%">$Lang::tr{'modem network bit error rate'}</td>
|
||||
<td>$bit_error_rate</td>
|
||||
</tr>
|
||||
END
|
||||
}
|
||||
print <<END;
|
||||
</tbody>
|
||||
</table>
|
||||
END
|
||||
|
||||
&Header::closebox();
|
||||
} else {
|
||||
&Header::openbox("100%", "center", $Lang::tr{'modem no connection'});
|
||||
print "<p>$Lang::tr{'modem no connection message'}</p>";
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
&Header::closebigbox();
|
||||
&Header::closepage();
|
||||
@@ -73,6 +73,9 @@ elsif ($pppsettings{'ACTION'} eq $Lang::tr{'save'})
|
||||
if ($pppsettings{'TYPE'} =~ /^(modem|serial|isdn)$/ && $pppsettings{'COMPORT'} !~ /^(ttyS0|ttyS1|ttyS2|ttyS3|ttyS4|ttyACM0|ttyACM1|ttyACM2|ttyACM3|ttyUSB0|ttyUSB1|ttyUSB2|ttyUSB3|rfcomm0|rfcomm1|isdn1|isdn2)$/) {
|
||||
$errormessage = $Lang::tr{'invalid input'};
|
||||
goto ERROR; }
|
||||
if ($pppsettings{'TYPE'} =~ /^(modem|serial|isdn)$/ && $pppsettings{'MONPORT'} !~ /^(ttyUSB0|ttyUSB1|ttyUSB2|ttyUSB3)$/) {
|
||||
$errormessage = $Lang::tr{'invalid input'};
|
||||
goto ERROR; }
|
||||
if ($pppsettings{'TYPE'} =~ /^(modem|serial)$/ && $pppsettings{'DTERATE'} !~ /^(9600|19200|38400|57600|115200|230400|460800|921600)$/) {
|
||||
$errormessage = $Lang::tr{'invalid input'};
|
||||
goto ERROR; }
|
||||
@@ -335,6 +338,13 @@ $selected{'COMPORT'}{'rfcomm0'} = '';
|
||||
$selected{'COMPORT'}{'rfcomm1'} = '';
|
||||
$selected{'COMPORT'}{$pppsettings{'COMPORT'}} = "selected='selected'";
|
||||
|
||||
$selected{'MONPORT'}{''} = '';
|
||||
$selected{'MONPORT'}{'ttyUSB0'} = '';
|
||||
$selected{'MONPORT'}{'ttyUSB1'} = '';
|
||||
$selected{'MONPORT'}{'ttyUSB2'} = '';
|
||||
$selected{'MONPORT'}{'ttyUSB3'} = '';
|
||||
$selected{'MONPORT'}{$pppsettings{'MONPORT'}} = "selected='selected'";
|
||||
|
||||
$selected{'DTERATE'}{'9600'} = '';
|
||||
$selected{'DTERATE'}{'19200'} = '';
|
||||
$selected{'DTERATE'}{'38400'} = '';
|
||||
@@ -583,6 +593,24 @@ END
|
||||
;
|
||||
}
|
||||
print "</select></td> "}
|
||||
|
||||
if ($pppsettings{'TYPE'} =~ /^(modem|serial)$/) {
|
||||
print <<END;
|
||||
<tr>
|
||||
<td colspan='3' width='75%'>$Lang::tr{'monitor interface'}:</td>
|
||||
<td width='25%'>
|
||||
<select name="MONPORT" style="width: 165px;">
|
||||
<option value="" $selected{'MONPORT'}{''}>---</option>
|
||||
<option value="ttyUSB0" $selected{'MONPORT'}{'ttyUSB0'}>ttyUSB0</option>
|
||||
<option value="ttyUSB1" $selected{'MONPORT'}{'ttyUSB1'}>ttyUSB1</option>
|
||||
<option value="ttyUSB2" $selected{'MONPORT'}{'ttyUSB2'}>ttyUSB2</option>
|
||||
<option value="ttyUSB3" $selected{'MONPORT'}{'ttyUSB3'}>ttyUSB3</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
END
|
||||
}
|
||||
|
||||
if ($pppsettings{'TYPE'} =~ /^(modem|serial)$/ ) {
|
||||
print <<END
|
||||
<tr>
|
||||
@@ -926,6 +954,7 @@ sub initprofile
|
||||
{
|
||||
$pppsettings{'PROFILENAME'} = $Lang::tr{'unnamed'};
|
||||
$pppsettings{'COMPORT'} = 'ttyS0';
|
||||
$pppsettings{'MONPORT'} = '';
|
||||
$pppsettings{'DTERATE'} = 115200;
|
||||
$pppsettings{'SPEAKER'} = 'off';
|
||||
$pppsettings{'RECONNECTION'} = 'persistent';
|
||||
|
||||
Reference in New Issue
Block a user