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

After the commit 43fc720657
("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.

Fixes: 43fc720657 ("base-files: generate "device" UCI type section for bridge")
Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
[rmilecki: use $ports for generate_bridge_vlan argument]
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: maurerr <mariusd84@gmail.com>
This commit is contained in:
INAGAKI Hiroshi 2021-05-23 20:30:58 +09:00 committed by maurerr
parent 8cf7530a15
commit 5543ef92d2

View File

@ -109,7 +109,7 @@ generate_network() {
ports="$ifname" ports="$ifname"
} }
[ -n "$ports" ] && { [ -n "$ports" -a -z "$bridge" ] && {
uci -q batch <<-EOF uci -q batch <<-EOF
add network device add network device
set network.@device[-1].name='br-$1' set network.@device[-1].name='br-$1'
@ -123,11 +123,12 @@ generate_network() {
} }
[ -n "$bridge" ] && { [ -n "$bridge" ] && {
[ -z "$ports" ] && ports="$ifname"
if [ -z "$vlan" ]; then if [ -z "$vlan" ]; then
bridge_vlan_id=$((bridge_vlan_id + 1)) bridge_vlan_id=$((bridge_vlan_id + 1))
vlan=$bridge_vlan_id vlan=$bridge_vlan_id
fi fi
generate_bridge_vlan $1 $bridge "$ifname" $vlan generate_bridge_vlan $1 $bridge "$ports" $vlan
ifname=$bridge.$vlan ifname=$bridge.$vlan
type="" type=""
} }