interfaces: stop mdp5 before starting

An ancinet dragon was woken from its slumber while reworking the interface
configuration code.  All things considered this is more than reasonable
although we do not yet know how this condition can be reached now as opposed
to 21.7 and if the inline termination of mdp5 will not invoke any sort of
deconfiguration (ppp-linkdown) that would harm the impending start of the
service.

PR: https://forum.opnsense.org/index.php?topic=26652.0
This commit is contained in:
Franco Fichtner 2022-02-02 11:39:48 +01:00
parent e235082f9c
commit 3ccd2f0bdf

View File

@ -1032,6 +1032,7 @@ function interface_bring_down($interface = "wan", $ifacecfg = false)
if (!empty($ppps)) {
foreach ($ppps as $ppp) {
if ($ifcfg['if'] == $ppp['if']) {
/* XXX $ifacecfg is very likely never false */
if (isset($ppp['ondemand']) && $ifacecfg === false) {
configdp_run('interface reconfigure', array($interface));
break;
@ -1162,11 +1163,9 @@ function interface_ppps_configure($interface)
return 0;
}
if (file_exists("/var/run/booting")) {
// Do not re-configure the interface if we are booting and it's already been started
if (isvalidpid("/var/run/{$ppp['type']}_{$interface}.pid")) {
return 0;
}
/* do not re-configure the interface if we are booting and it's already been started */
if (file_exists('/var/run/booting') && isvalidpid("/var/run/{$ppp['type']}_{$interface}.pid")) {
return 0;
}
$ports = explode(',', $ppp['ports']);
@ -1430,6 +1429,9 @@ EOD;
fclose($fd);
unset($mpdconf);
/* stop the service as a precaution */
killbypid("/var/run/{$ppp['type']}_{$interface}.pid", 'TERM', true);
// Create the uptime log if requested and if it doesn't exist already, or delete it if it is no longer requested.
if (isset($ppp['uptime'])) {
@touch("/conf/{$ifcfg['if']}.log");