mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 16:44:39 +00:00
interfaces: zero prefix "vlan" and "qinq" interface names to prevent collisions on vlans.(https://github.com/opnsense/core/issues/5560)
Although the prepended 0 might look less intuitive it prevents overlaps when creating new vlans using "ifconfig vlan create" (2637e6ebca/src/etc/inc/interfaces.lib.inc (L77)), to keep qinq and vlan's consistent prepend on both types. ref2637e6ebca
This commit is contained in:
parent
aa3c27df0b
commit
d17e9c737d
@ -53,13 +53,13 @@ class VlanSettingsController extends ApiMutableModelControllerBase
|
||||
return (string)$current->vlanif;
|
||||
} else {
|
||||
// autonumber new
|
||||
$ifid = -1;
|
||||
$ifid = 0;
|
||||
foreach ($this->getModel()->vlan->iterateItems() as $node) {
|
||||
if (strpos((string)$node->vlanif, $prefix) === 0) {
|
||||
$ifid = max($ifid, (int)filter_var((string)$node->vlanif, FILTER_SANITIZE_NUMBER_INT));
|
||||
}
|
||||
}
|
||||
return $prefix . ($ifid + 1);
|
||||
return sprintf("%s0%d", $prefix , ($ifid + 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user