Interfaces: Other Types: VLAN - allow manual proto selection, closes https://github.com/opnsense/core/issues/6679

This commit is contained in:
Ad Schellevis 2023-07-21 18:33:34 +02:00
parent c3db32722d
commit 6487a9b62e
4 changed files with 23 additions and 2 deletions

View File

@ -161,7 +161,9 @@ function interfaces_vlan_configure($verbose = false)
}
}
foreach ($config['vlans']['vlan'] as $vlan) {
$vlan['proto'] = empty($all_parents[$vlan['vlanif']]) ? '802.1q' : '802.1ad';
if (empty($vlan['proto'])) {
$vlan['proto'] = empty($all_parents[$vlan['vlanif']]) ? '802.1q' : '802.1ad';
}
_interfaces_vlan_configure($vlan);
}

View File

@ -27,6 +27,15 @@
<type>dropdown</type>
<help>802.1Q VLAN PCP (priority code point)</help>
</field>
<field>
<id>vlan.proto</id>
<type>dropdown</type>
<advanced>true</advanced>
<help>
Enforce protocol selection, 802.1Qis the default for vlan interfaces,
802.1ad is used when the parent is a vlan (QinQ)
</help>
</field>
<field>
<id>vlan.descr</id>
<label>Description</label>

View File

@ -42,6 +42,14 @@
<pcp7 value="7">Network Control (7, highest)</pcp7>
</OptionValues>
</pcp>
<proto type="OptionField">
<Required>N</Required>
<BlankDesc>Auto</BlankDesc>
<OptionValues>
<opt1 value="802.1q">802.1Q</opt1>
<opt2 value="802.1ad">802.1ad</opt2>
</OptionValues>
</proto>
<descr type="TextField">
<Required>N</Required>
</descr>

View File

@ -74,7 +74,9 @@ foreach (legacy_interfaces_details() as $ifname => $ifdetails) {
legacy_interface_destroy($ifname);
} else {
$vlan = $all_vlans[$ifname];
$vlan['proto'] = empty($all_parents[$vlan['vlanif']]) ? '802.1q' : '802.1ad';
if (empty($vlan['proto'])) {
$vlan['proto'] = empty($all_parents[$vlan['vlanif']]) ? '802.1q' : '802.1ad';
}
$cvlan = $ifdetails['vlan'];
if ($vlan['tag'] != $cvlan['tag'] || $vlan['if'] != $cvlan['parent']) {
/* option 2: changed vlan, unlink and relink */