mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +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 %menuhash = ();
|
||||||
my $menu = \%menuhash;
|
my $menu = \%menuhash;
|
||||||
%settings = ();
|
%settings = ();
|
||||||
%pppsettings = ();
|
|
||||||
my @URI = split('\?', $ENV{'REQUEST_URI'});
|
my @URI = split('\?', $ENV{'REQUEST_URI'});
|
||||||
|
|
||||||
### Make sure this is an SSL request
|
### Make sure this is an SSL request
|
||||||
@@ -100,7 +99,6 @@ if ($ENV{'SERVER_ADDR'} && $ENV{'HTTPS'} ne 'on') {
|
|||||||
|
|
||||||
### Initialize environment
|
### Initialize environment
|
||||||
&General::readhash("${swroot}/main/settings", \%settings);
|
&General::readhash("${swroot}/main/settings", \%settings);
|
||||||
&General::readhash("${swroot}/ppp/settings", \%pppsettings);
|
|
||||||
$hostname = $settings{'HOSTNAME'};
|
$hostname = $settings{'HOSTNAME'};
|
||||||
$hostnameintitle = 0;
|
$hostnameintitle = 0;
|
||||||
|
|
||||||
@@ -438,7 +436,7 @@ sub genmenu {
|
|||||||
$menu->{'01.system'}{'subMenu'}->{'21.wlan'}{'enabled'} = 1;
|
$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;
|
$menu->{'02.status'}{'subMenu'}->{'74.modem-status'}{'enabled'} = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -610,15 +608,11 @@ sub cleanhtml {
|
|||||||
|
|
||||||
sub connectionstatus
|
sub connectionstatus
|
||||||
{
|
{
|
||||||
my %pppsettings = ();
|
|
||||||
my $iface='';
|
my $iface='';
|
||||||
|
|
||||||
$pppsettings{'PROFILENAME'} = 'None';
|
|
||||||
&General::readhash("${General::swroot}/ppp/settings", \%pppsettings);
|
|
||||||
|
|
||||||
my $profileused='';
|
my $profileused='';
|
||||||
unless ($Network::ethernet{'RED_TYPE'} =~ /^(DHCP|STATIC)$/) {
|
unless ($Network::ethernet{'RED_TYPE'} =~ /^(DHCP|STATIC)$/) {
|
||||||
$profileused="- $pppsettings{'PROFILENAME'}";
|
$profileused="- $Network::ppp{'PROFILENAME'}";
|
||||||
}
|
}
|
||||||
|
|
||||||
my ($timestr, $connstate);
|
my ($timestr, $connstate);
|
||||||
@@ -629,9 +623,9 @@ sub connectionstatus
|
|||||||
$timestr = &General::age("${General::swroot}/red/active");
|
$timestr = &General::age("${General::swroot}/red/active");
|
||||||
$connstate = "<span>$Lang::tr{'connected'} - (<span>$timestr</span>) $profileused</span>";
|
$connstate = "<span>$Lang::tr{'connected'} - (<span>$timestr</span>) $profileused</span>";
|
||||||
} else {
|
} 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>";
|
$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>";
|
$connstate = "<span>$Lang::tr{'dod waiting'} $profileused</span>";
|
||||||
} else {
|
} else {
|
||||||
$connstate = "<span>$Lang::tr{'connecting'} $profileused</span>" if (system("ps -ef | grep -q '[p]ppd'"));
|
$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 experimental 'smartmatch';
|
||||||
use Socket;
|
use Socket;
|
||||||
|
|
||||||
# System ethernet configuration
|
|
||||||
our %ethernet = ();
|
our %ethernet = ();
|
||||||
|
our %ppp = ();
|
||||||
|
|
||||||
|
# Read configuration files
|
||||||
&General::readhash("${General::swroot}/ethernet/settings", \%ethernet);
|
&General::readhash("${General::swroot}/ethernet/settings", \%ethernet);
|
||||||
|
&General::readhash("${General::swroot}/ppp/settings", \%ppp);
|
||||||
|
|
||||||
# List of all possible network zones that can be configured
|
# List of all possible network zones that can be configured
|
||||||
our @known_network_zones = ("red", "green", "orange", "blue");
|
our @known_network_zones = ("red", "green", "orange", "blue");
|
||||||
|
|||||||
Reference in New Issue
Block a user