[PATCH] base-files: fix configuration generation of network if "bridge" exists

Rafał Miłecki zajec5 at gmail.com
Sun May 23 14:06:15 PDT 2021


On 23.05.2021 13:30, INAGAKI Hiroshi wrote:
> After the commit 43fc720657c6e3b30c6ed89d7227ee6e646c158b
> ("base-files: generate "device UCI type section for bridge"), the wrong
> network configuration is generated for the devices that already have the
> bridge device section for VLAN, such as the devices in realtek target.
> 
> As a result, the bridge device by additional "device" section is
> specified to the "ports" option in the "bridge-vlan" section and netifd
> shuts down the switch and the ethernet when the network service started.
> 
> --- generated config ---
> 
> config device 'switch'
>          option name 'switch'
>          option type 'bridge'
>          option macaddr '34:76:c5:xx:xx:a8'
> 
> config device
>          option name 'br-wan'
>          option type 'bridge'
>          list ports 'lan1'
> 	... (truncated)
>          list ports 'lan9'
> 
> config bridge-vlan 'wan_vlan'
>          option device 'switch'
>          option vlan '1'
>          option ports 'br-wan'
> 
> --- config end ---

Thanks for bringing this up Hiroshi.

I'm looking at existing code, at the commit be09c5a3cd65 ("base-files:
add board.d support for bridge device") and I have some problems
understanding those bridges.

If you can, please kindly answer me two questions:


1. Why realtek treats lan ports as WAN?

I mean this code:

for lan in /sys/class/net/lan*; do
	lan_list="$lan_list $(basename $lan)"
done
ucidef_set_interface_wan "$lan_list"


2. What's up with the magic VLAN ID 100?

I found this:
ucidef_set_interface "lan" ifname "lan1n:t" protocol "static" vlan 100

Why "lan" logic interface requires VLAN ID 100?


Finally: could you post your /etc/config/network from a working setup?



More information about the openwrt-devel mailing list