base-files: config_generate: properly handle multiple switches

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 47646
This commit is contained in:
Jo-Philipp Wich 2015-11-25 15:43:33 +00:00
parent 04b8b97fff
commit 63c2111e86

View file

@ -172,6 +172,16 @@ calculate_switch_vlans() {
eval device="\$dev$((vlan_off++ % n_cpu))" eval device="\$dev$((vlan_off++ % n_cpu))"
[ $n_vlan -gt $n_cpu ] && device="$device.$vlan_off" [ $n_vlan -gt $n_cpu ] && device="$device.$vlan_off"
# quirk: append ifnames for subsequent switches
case "$switch" in switch[1-9])
local prev_devs="$(uci -q get "network.$role.ifname")"
if echo "$prev_devs" | grep -wq "$device"; then
device="$prev_devs"
else
device="$prev_devs $device"
fi
;; esac
uci -q batch <<-EOF uci -q batch <<-EOF
delete network.$role delete network.$role
set network.$role='interface' set network.$role='interface'