TOS 6.0+ Initial network config should use OpenWrt 21.02 syntax
Summary
Initial network configuration after first boot results in the mix of old style (OpenWrt 19.07 and older) and new style (OpenWrt 21.02) config.
There is old style interface
config alongside the new style configuration split into interface
and device
.
Turris OS based on OpenWrt 21.02 should create initial configuration that uses OpenWrt 21.02 configuration syntax, not the deprecated one.
Details
Reproducible on Mox ABC with TOS 6.2.1.
I believe that this patch is somehow involved: https://gitlab.nic.cz/turris/os/build/-/blob/hbk/patches/openwrt/wip/0004-mvebu-initial-support-for-MOX-on-5.4-kernel.patch
But I haven't dug deep enough, so I could be wrong about that.
Initial network configuration after first boot (factory reset, reflash from medkit, ...) looks like this.
/etc/config/network
config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix '<some prefix>'
config device <--- actual configuration of br-lan bridge
option name 'br-lan'
option type 'bridge'
list ports 'lan1'
list ports 'lan2'
list ports 'lan3'
list ports 'lan4'
config interface 'wan'
option ifname 'eth0'
option proto 'none'
config interface 'lan'
option type 'bridge' <--- this should not be there, just in device section
option macaddr 'AA:BB:CC:11:22:33'
option ifname 'lan1 lan2 lan3 lan4' <--- deprecated “option ifname”
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option _turris_mode 'managed'
option ip6assign '60'
# it doesn't refer to device 'br-lan' at all
Which network interfaces will be used for bridge br-lan
depends on the last configuration section that defines either list ports
or option ifname
.
So this example config
config device
option name 'br-lan'
option type 'bridge'
list ports 'lan1'
list ports 'lan2'
list ports 'lan3'
list ports 'lan4'
config interface 'lan'
option type 'bridge'
option macaddr 'AA:BB:CC:11:22:33'
option ifname 'lan1 lan3'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option _turris_mode 'managed'
option ip6assign '60'
will result in following network setup:
root@turris:/# brctl show
bridge name bridge id STP enabled interfaces
br-lan 7fff.d858d700b6ad no lan3
lan1
These two conflicting definitions of bridge ports might cause issues later:
- (a) If only one config section of these two is updated (by hand, Luci), the second config section might still override it
- (b) Could cause confusion while reading the TOS diagnostics (e.g. "Why is that config still there?")
- (c) We have to clean the network config on every update from reforis to make sure we have a valid config and don't have the conflicting definitions.