mvc: allow referencing disabled interfaces in LinkAddressField

This prevents validation errors when interfaces are temporarily
disabled.  Other device components received similar fixes in the
past due to this "glitch" of not offering valid devices and selectpickers
would lose their correct value on save too (the field is a bit different
here but the same principle applies).
This commit is contained in:
Franco Fichtner 2025-04-15 12:33:53 +02:00
parent 25585eb6b9
commit f30c28ca79

View File

@ -53,7 +53,7 @@ class LinkAddressField extends BaseField
self::$option_groups['ipalias'] = ['items' => [], 'title' => gettext('IP Alias')];
foreach ($cfg->interfaces->children() as $ifname => $node) {
$descr = !empty((string)$node->descr) ? (string)$node->descr : strtoupper($ifname);
if (!empty((string)$node->virtual) || empty((string)$node->enable)) {
if (!empty((string)$node->virtual)) {
continue;
}
self::$known_addresses[$ifname] = $descr;