Interfaces/Other Types/VLAN - outer vlan should be marked "ad", inner is always "q". closes https://github.com/opnsense/core/issues/5893

This commit is contained in:
Ad Schellevis 2023-01-20 18:57:18 +01:00
parent 7fa6fbbc5d
commit d8f209420d
2 changed files with 9 additions and 5 deletions

View File

@ -154,11 +154,14 @@ function interfaces_vlan_configure($verbose = false)
$all_parents = [];
foreach ($config['vlans']['vlan'] as $vlan) {
if (!in_array($vlan['vlanif'], $all_parents)) {
$all_parents[] = $vlan['vlanif'];
if (!isset($all_parents[$vlan['if']])) {
$all_parents[$vlan['if']] = 0;
}
$all_parents[$vlan['if']]++ ;
}
}
foreach ($config['vlans']['vlan'] as $vlan) {
$vlan['proto'] = !in_array($vlan['if'], $all_parents) ? '802.1q' : '802.1ad';
$vlan['proto'] = empty($all_parents[$vlan['vlanif']]) ? '802.1q' : '802.1ad';
_interfaces_vlan_configure($vlan);
}

View File

@ -54,9 +54,10 @@ if (file_exists($vfilename) && filesize($vfilename) > 0) {
if (!empty($config['vlans']['vlan'])) {
foreach ($config['vlans']['vlan'] as $vlan) {
$all_vlans[$vlan['vlanif']] = $vlan;
if (!in_array($vlan['vlanif'], $all_parents)) {
$all_parents[] = $vlan['vlanif'];
if (!isset($all_parents[$vlan['if']])) {
$all_parents[$vlan['if']] = 0;
}
$all_parents[$vlan['if']]++ ;
}
}
@ -67,7 +68,7 @@ foreach (legacy_interfaces_details() as $ifname => $ifdetails) {
}
if (isset($all_vlans[$ifname])) {
$vlan = $all_vlans[$ifname];
$vlan['proto'] = !in_array($vlan['if'], $all_parents) ? '802.1q' : '802.1ad';
$vlan['proto'] = empty($all_parents[$vlan['vlanif']]) ? '802.1q' : '802.1ad';
$cvlan = $ifdetails['vlan'];
if (empty($vlan)) {
// option 1: removed vlan