mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
network-functions.pl: Read PPP settings globally
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
@@ -88,7 +88,6 @@ END
|
||||
my %menuhash = ();
|
||||
my $menu = \%menuhash;
|
||||
%settings = ();
|
||||
%pppsettings = ();
|
||||
my @URI = split('\?', $ENV{'REQUEST_URI'});
|
||||
|
||||
### Make sure this is an SSL request
|
||||
@@ -100,7 +99,6 @@ if ($ENV{'SERVER_ADDR'} && $ENV{'HTTPS'} ne 'on') {
|
||||
|
||||
### Initialize environment
|
||||
&General::readhash("${swroot}/main/settings", \%settings);
|
||||
&General::readhash("${swroot}/ppp/settings", \%pppsettings);
|
||||
$hostname = $settings{'HOSTNAME'};
|
||||
$hostnameintitle = 0;
|
||||
|
||||
@@ -438,7 +436,7 @@ sub genmenu {
|
||||
$menu->{'01.system'}{'subMenu'}->{'21.wlan'}{'enabled'} = 1;
|
||||
}
|
||||
|
||||
if ( $Network::ethernet{'RED_TYPE'} eq "PPPOE" && $pppsettings{'MONPORT'} ne "" ) {
|
||||
if ( $Network::ethernet{'RED_TYPE'} eq "PPPOE" && $Network::ppp{'MONPORT'} ne "" ) {
|
||||
$menu->{'02.status'}{'subMenu'}->{'74.modem-status'}{'enabled'} = 1;
|
||||
}
|
||||
|
||||
@@ -610,15 +608,11 @@ sub cleanhtml {
|
||||
|
||||
sub connectionstatus
|
||||
{
|
||||
my %pppsettings = ();
|
||||
my $iface='';
|
||||
|
||||
$pppsettings{'PROFILENAME'} = 'None';
|
||||
&General::readhash("${General::swroot}/ppp/settings", \%pppsettings);
|
||||
|
||||
my $profileused='';
|
||||
unless ($Network::ethernet{'RED_TYPE'} =~ /^(DHCP|STATIC)$/) {
|
||||
$profileused="- $pppsettings{'PROFILENAME'}";
|
||||
$profileused="- $Network::ppp{'PROFILENAME'}";
|
||||
}
|
||||
|
||||
my ($timestr, $connstate);
|
||||
@@ -629,9 +623,9 @@ sub connectionstatus
|
||||
$timestr = &General::age("${General::swroot}/red/active");
|
||||
$connstate = "<span>$Lang::tr{'connected'} - (<span>$timestr</span>) $profileused</span>";
|
||||
} else {
|
||||
if ((open(KEEPCONNECTED, "</var/ipfire/red/keepconnected") == false) && ($pppsettings{'RECONNECTION'} eq "persistent")) {
|
||||
if ((open(KEEPCONNECTED, "</var/ipfire/red/keepconnected") == false) && ($Network::ppp{'RECONNECTION'} eq "persistent")) {
|
||||
$connstate = "<span>$Lang::tr{'connection closed'} $profileused</span>";
|
||||
} elsif (($pppsettings{'RECONNECTION'} eq "dialondemand") && ( -e "${General::swroot}/red/dial-on-demand")) {
|
||||
} elsif (($Network::ppp{'RECONNECTION'} eq "dialondemand") && ( -e "${General::swroot}/red/dial-on-demand")) {
|
||||
$connstate = "<span>$Lang::tr{'dod waiting'} $profileused</span>";
|
||||
} else {
|
||||
$connstate = "<span>$Lang::tr{'connecting'} $profileused</span>" if (system("ps -ef | grep -q '[p]ppd'"));
|
||||
|
||||
@@ -28,10 +28,12 @@ require "/var/ipfire/general-functions.pl";
|
||||
use experimental 'smartmatch';
|
||||
use Socket;
|
||||
|
||||
# System ethernet configuration
|
||||
our %ethernet = ();
|
||||
our %ppp = ();
|
||||
|
||||
# Read configuration files
|
||||
&General::readhash("${General::swroot}/ethernet/settings", \%ethernet);
|
||||
&General::readhash("${General::swroot}/ppp/settings", \%ppp);
|
||||
|
||||
# List of all possible network zones that can be configured
|
||||
our @known_network_zones = ("red", "green", "orange", "blue");
|
||||
|
||||
Reference in New Issue
Block a user