You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey @pandafy@nemesifier , I've analyzed the problem and have a proposed solution.
Issue Analysis
The bug occurs when creating an 802.1q VLAN interface with an empty network field. The current behavior generates an invalid OpenWrt configuration by creating an interface section with an empty name (config interface ''), which is not a valid UCI configuration.
Current Behavior
When the network field is an empty string, the converter still creates an interface section but with an empty name, resulting in:
config interface '' # <-- This is invalid
option device 'br-wifi.200'
option enabled '1'
option proto 'none'
Expected Behavior
When the network field is empty or not specified, we should only create the device configuration without generating an associated interface section, resulting in:
config device 'device_'
option ifname 'br-wifi'
option name 'br-wifi.200'
option type '8021q'
option vid '200'
Proposed Solution
We should modify the converter to only generate the interface section when the network field has a valid value. Here's a proposed code change:
defrender_interface(self, interface, **kwargs):
network=interface.get('network')
# Only generate interface section if network field has a valueifnotnetwork:
returnself._render_device_config(interface)
# Rest of the existing interface rendering code
...
This change ensures we maintain backward compatibility while fixing the invalid configuration generation.
Would you like me to prepare a pull request with this fix? Please let me know if you need any clarification or have questions about the proposed solution.
Describe the bug
Creating VLAN 802.1q field with a blank interface will generate an invalid configuration.
Steps To Reproduce
Try generating OpenWrt configuration using the following NetJSON
Generated Configuration
The text was updated successfully, but these errors were encountered: