This is not a FreeBSD restriction, nor is it inherited from pfSense. In fact, I raised similar concerns when the naming scheme was changed back in 2022.
There were essentially three reasons for the current restrictions:
1. Support for stacked VLANs (QinQ): The old naming convention (`igb0_vlan100`) was abandoned in 22.1.4 because stacked VLANs (`igb0_vlan100_vlan200`) could exceed FreeBSD's 15-character interface name limit.
https://forum.opnsense.org/index.php?topic=27931.0
2. Avoiding naming collisions: The leading zero is intentional to avoid collisions with interface names automatically generated by FreeBSD's interface cloning mechanism. The actual commit that introduced the stricter validation can be found here:
https://github.com/opnsense/core/commit/2d74c6b641d7dfd0594cb4e8ca84b25667c599bf
3. Legacy code: This is probably the most relevant reason for not allowing arbitrary names. Franco explained in a German forum thread in January 2023 that OPNsense has historically relied on string matching of interface names to determine interface types. Unfortunately, these checks are not consistent throughout the codebase. Allowing arbitrary names could therefore cause subtle problems, while refactoring those checks could introduce regressions.
https://forum.opnsense.org/index.php?topic=31802.0
Technically, you can still rename VLAN interfaces by editing `config.xml`, provided you update all references accordingly. I would be cautious about completely arbitrary names, though, given Franco's explanation.
IMHO, decoupling VLAN interface names from their parent interfaces and enforcing a particular naming convention are two separate design decisions. While I can understand the rationale for the former, the latter appears to be primarily a consequence of technical debt rather than an inherent technical necessity.
It would be interesting to know whether these limitations in the OPNsense codebase still exist today as technical debt to the same extent as they did in 2022/2023.
There were essentially three reasons for the current restrictions:
1. Support for stacked VLANs (QinQ): The old naming convention (`igb0_vlan100`) was abandoned in 22.1.4 because stacked VLANs (`igb0_vlan100_vlan200`) could exceed FreeBSD's 15-character interface name limit.
https://forum.opnsense.org/index.php?topic=27931.0
2. Avoiding naming collisions: The leading zero is intentional to avoid collisions with interface names automatically generated by FreeBSD's interface cloning mechanism. The actual commit that introduced the stricter validation can be found here:
https://github.com/opnsense/core/commit/2d74c6b641d7dfd0594cb4e8ca84b25667c599bf
3. Legacy code: This is probably the most relevant reason for not allowing arbitrary names. Franco explained in a German forum thread in January 2023 that OPNsense has historically relied on string matching of interface names to determine interface types. Unfortunately, these checks are not consistent throughout the codebase. Allowing arbitrary names could therefore cause subtle problems, while refactoring those checks could introduce regressions.
https://forum.opnsense.org/index.php?topic=31802.0
Technically, you can still rename VLAN interfaces by editing `config.xml`, provided you update all references accordingly. I would be cautious about completely arbitrary names, though, given Franco's explanation.
IMHO, decoupling VLAN interface names from their parent interfaces and enforcing a particular naming convention are two separate design decisions. While I can understand the rationale for the former, the latter appears to be primarily a consequence of technical debt rather than an inherent technical necessity.
It would be interesting to know whether these limitations in the OPNsense codebase still exist today as technical debt to the same extent as they did in 2022/2023.
"