summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2015-11-25 15:43:33 +0000
committerJo-Philipp Wich <jow@openwrt.org>2015-11-25 15:43:33 +0000
commit63c2111e86253763ed9409638db57e9c063f476c (patch)
treee3caee61977bead51ebf4a5d67dd3557f84ed6b5 /package
parent04b8b97fffd205a9c4a7f156b99378adc206e0ae (diff)
downloadmtk-20170518-63c2111e86253763ed9409638db57e9c063f476c.zip
mtk-20170518-63c2111e86253763ed9409638db57e9c063f476c.tar.gz
mtk-20170518-63c2111e86253763ed9409638db57e9c063f476c.tar.bz2
base-files: config_generate: properly handle multiple switches
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org> SVN-Revision: 47646
Diffstat (limited to 'package')
-rwxr-xr-xpackage/base-files/files/bin/config_generate10
1 files changed, 10 insertions, 0 deletions
diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate
index 40d7047..29fec8e 100755
--- a/package/base-files/files/bin/config_generate
+++ b/package/base-files/files/bin/config_generate
@@ -172,6 +172,16 @@ calculate_switch_vlans() {
eval device="\$dev$((vlan_off++ % n_cpu))"
[ $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
delete network.$role
set network.$role='interface'