diff --git a/src/etc/inc/console.inc b/src/etc/inc/console.inc index 4568f0b3a..23c74cbcc 100644 --- a/src/etc/inc/console.inc +++ b/src/etc/inc/console.inc @@ -53,8 +53,8 @@ function timeout($timer = 7) function is_interface_mismatch($locked = true) { - $patterns = ['^impossiblecontrolmatch$']; $mismatch = false; + $patterns = []; foreach (plugins_devices() as $device) { if (!$device['volatile']) { @@ -62,14 +62,14 @@ function is_interface_mismatch($locked = true) } } - $regex = '/' . implode('|', $patterns) . '/'; + $regex = count($patterns) ? '/' . implode('|', $patterns) . '/' : null; foreach (legacy_config_get_interfaces(['virtual' => false]) as $ifname => $ifcfg) { if ($locked && !empty($ifcfg['lock'])) { /* Do not mismatch if any lock was issued */ $mismatch = false; break; - } elseif (preg_match($regex, $ifcfg['if'])) { + } elseif (!empty($regex) && preg_match($regex, $ifcfg['if'])) { /* Do not check these interfaces */ continue; } elseif (does_interface_exist($ifcfg['if']) == false) { diff --git a/src/etc/inc/plugins.inc b/src/etc/inc/plugins.inc index 017a33226..c5e100216 100644 --- a/src/etc/inc/plugins.inc +++ b/src/etc/inc/plugins.inc @@ -96,6 +96,7 @@ function plugins_devices() $devices = []; $defaults = [ 'configurable' => true, /* allow to configure IP connectivity */ + 'pattern' => '^impossiblecontrolmatch$', /* never match by default */ 'spoofmac' => true, /* allow to change the MAC address */ 'volatile' => false, /* device known to persist */ ]; @@ -109,7 +110,6 @@ function plugins_devices() $func = sprintf('%s_devices', $name); if (function_exists($func)) { foreach ($func() as $work) { - /* XXX make sure 'pattern' exists as a prerequisite */ foreach ($defaults as $key => $val) { if (!isset($work[$key])) { $work[$key] = $val;