interfaces: Fix unable to bring up multiple loopback

This fixes a bug:
* Loopback interfaces other than the one being configured/created
  are all going to be removed/destroyed.
This commit is contained in:
Johnny S. Lee 2022-07-14 11:05:43 +08:00 committed by Franco Fichtner
parent 59b076ba4e
commit 198de61c02

View File

@ -83,12 +83,12 @@ function loopback_configure_do($verbose = false, $device = null)
// (re)configure loopback devices
foreach ($loopbacks as $loopback) {
$device_name = "lo{$loopback->deviceId}";
$configured_devices[] = $device_name;
if ($device !== null && $device != $device_name) {
continue;
}
$configured_devices[] = $device_name;
if (!in_array($device_name, $configured_interfaces)) {
mwexecf('/sbin/ifconfig %s create', [$device_name]);
}