Skip to content

Commit

Permalink
Interfaces/Other Types/VLAN - outer vlan should be marked "ad", inner…
Browse files Browse the repository at this point in the history
… is always "q". closes #5893

(cherry picked from commit d8f2094)
  • Loading branch information
AdSchellevis authored and fichtner committed Jan 21, 2023
1 parent 2e78add commit 021f656
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/etc/inc/interfaces.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
7 changes: 4 additions & 3 deletions src/opnsense/scripts/interfaces/reconfigure_vlans.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@
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']]++ ;
}
}

Expand All @@ -67,7 +68,7 @@
}
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
Expand Down

0 comments on commit 021f656

Please sign in to comment.