From 3ccd2f0bdf07e3181fde8ed2fae09b9161465edc Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Wed, 2 Feb 2022 11:39:48 +0100 Subject: [PATCH] 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 --- src/etc/inc/interfaces.inc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index d8cee2130..652e42a67 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -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");