From 2fe464a712f8da597475d63a0ad28ec678eb404a Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Tue, 17 Dec 2019 14:37:26 +0100 Subject: [PATCH] lantiq: reorganize 02_network board.d files This reorganizes 02_network board.d files based on what's done for ath79 and ramips: Instead of putting all settings into a single big case, the interface/dsl/MAC address setup is put into separate functions with a specific switch case for each of them. This makes grouping of devices much easier and should be easier to read, too. Signed-off-by: Adrian Schmutzler --- .../ase/base-files/etc/board.d/02_network | 71 +++-- .../falcon/base-files/etc/board.d/02_network | 43 ++- .../xrx200/base-files/etc/board.d/02_network | 271 ++++++++++-------- .../xway/base-files/etc/board.d/02_network | 193 +++++++------ .../base-files/etc/board.d/02_network | 76 +++-- 5 files changed, 378 insertions(+), 276 deletions(-) diff --git a/target/linux/lantiq/ase/base-files/etc/board.d/02_network b/target/linux/lantiq/ase/base-files/etc/board.d/02_network index 2334d6c25b..0bda3e4763 100755 --- a/target/linux/lantiq/ase/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/ase/base-files/etc/board.d/02_network @@ -7,37 +7,50 @@ . /lib/functions/system.sh . /lib/functions/lantiq.sh -board_config_update - -annex="a" - -lan_mac="" -wan_mac="" +lantiq_setup_interfaces() +{ + local board="$1" + + case "$board" in + *) + ucidef_set_interface_lan 'eth0' + ;; + esac +} + +lantiq_setup_dsl() +{ + local board="$1" + local annex="b" + + case "$board" in + esac + + lantiq_setup_dsl_helper "$annex" +} + +lantiq_setup_macs() +{ + local board="$1" + local lan_mac="" + local wan_mac="" + + case "$board" in + allnet,all0333cj) + lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr) + wan_mac=$(macaddr_add "$lan_mac" 1) + ;; + esac + + [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac" + [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac" +} +board_config_update board=$(board_name) - -case "$board" in -allnet,all0333cj) - annex="b" - lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr) - wan_mac=$(macaddr_add "$lan_mac" 1) - ucidef_set_interface_lan 'eth0' - ;; -netgear,dgn1000b) - annex="b" - ucidef_set_interface_lan 'eth0' - ;; -*) - ucidef_set_interface_lan 'eth0' - ;; -esac - -lantiq_setup_dsl_helper "$annex" - -[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac" -[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac" - +lantiq_setup_interfaces $board +lantiq_setup_dsl $board +lantiq_setup_macs $board board_config_flush exit 0 - diff --git a/target/linux/lantiq/falcon/base-files/etc/board.d/02_network b/target/linux/lantiq/falcon/base-files/etc/board.d/02_network index 997f4c741f..7998efc2a0 100755 --- a/target/linux/lantiq/falcon/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/falcon/base-files/etc/board.d/02_network @@ -7,21 +7,46 @@ . /lib/functions/system.sh . /lib/functions/lantiq.sh -board_config_update +lantiq_setup_interfaces() +{ + local board="$1" + + case "$board" in + *) + ucidef_set_interface_lan 'eth0' + ;; + esac +} + +lantiq_setup_dsl() +{ + local board="$1" + local annex="a" -annex="a" + case "$board" in + esac -lan_mac="" -wan_mac="" + lantiq_setup_dsl_helper "$annex" +} -ucidef_set_interface_lan 'eth0' +lantiq_setup_macs() +{ + local board="$1" + local lan_mac="" + local wan_mac="" -lantiq_setup_dsl_helper "$annex" + case "$board" in + esac -[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac" -[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac" + [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac" + [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac" +} +board_config_update +board=$(board_name) +lantiq_setup_interfaces $board +lantiq_setup_dsl $board +lantiq_setup_macs $board board_config_flush exit 0 - diff --git a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network index 05e235b096..f39898263d 100755 --- a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network @@ -7,128 +7,169 @@ . /lib/functions/system.sh . /lib/functions/lantiq.sh -board_config_update +lantiq_setup_interfaces() +{ + local board="$1" -annex="a" + case "$board" in + alphanetworks,asl56026) + ucidef_add_switch "switch0" \ + "2:lan" "3:lan" "6t@eth0" + ;; + arcadyan,arv7519rw22) + ucidef_add_switch "switch0" \ + "0:lan:5" "2:lan:3" "3:lan:4" "4:lan:1" "5:lan:2" "6t@eth0" + ;; + arcadyan,vg3503j) + ucidef_add_switch "switch0" \ + "2:lan:2" "4:lan:1" "6t@eth0" + ;; + arcadyan,vgv7510kw22-brn|\ + arcadyan,vgv7510kw22-nor) + ucidef_add_switch "switch0" \ + "2:lan:2" "3:lan:1" "4:lan:4" "5:lan:3" "0:wan:5" "6t@eth0" + ;; + arcadyan,vgv7519-brn|\ + arcadyan,vgv7519-nor|\ + lantiq,easy80920-nand|\ + lantiq,easy80920-nor) + ucidef_add_switch "switch0" \ + "0:lan:4" "1:lan:3" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0" + ;; + avm,fritz3370-rev2-hynix|\ + avm,fritz3370-rev2-micron|\ + avm,fritz7360sl|\ + avm,fritz7362sl) + ucidef_add_switch "switch0" \ + "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0" + ;; + bt,homehub-v5a) + ucidef_add_switch "switch0" \ + "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0" + ;; + buffalo,wbmr-300hpd) + ucidef_add_switch "switch0" \ + "5:lan:2" "2:lan:3" "3:lan:4" "4:wan:1" "6t@eth0" + ;; + tplink,tdw8970|\ + tplink,tdw8980) + ucidef_add_switch "switch0" \ + "0:lan:2" "2:lan:3" "4:lan:4" "5:lan:1" "6t@eth0" + ;; + tplink,vr200|\ + tplink,vr200v) + ucidef_add_switch "switch0" \ + "0:lan" "2:lan" "4:lan" "5:lan" "6t@eth0" + ;; + zyxel,p-2812hnu-f1|\ + zyxel,p-2812hnu-f3) + ucidef_add_switch "switch0" \ + "0:lan" "1:lan" "2:lan" "4:lan" "5:wan" "6t@eth0" + ;; + *) + ucidef_set_interface_lan 'eth0' + ;; + esac +} -lan_mac="" -wan_mac="" +lantiq_setup_dsl() +{ + local board="$1" + local annex="a" -board=$(board_name) + case "$board" in + arcadyan,vgv7510kw22-brn|\ + arcadyan,vgv7510kw22-nor|\ + avm,fritz3370-rev2-hynix|\ + avm,fritz3370-rev2-micron|\ + avm,fritz7360sl|\ + avm,fritz7362sl|\ + avm,fritz7412) + annex="b" + ;; + esac + + lantiq_setup_dsl_helper "$annex" +} -case "$board" in -alphanetworks,asl56026) - lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr) - wan_mac=$(mtd_get_mac_ascii uboot_env wanmac) - ucidef_add_switch "switch0"\ - "2:lan" "3:lan" "6t@eth0" - ;; -arcadyan,arv7519rw22) - wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0x16)" 1) - ucidef_add_switch "switch0" \ - "0:lan:5" "2:lan:3" "3:lan:4" "4:lan:1" "5:lan:2" "6t@eth0" - ;; -arcadyan,vg3503j) - lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr) - wan_mac=$(macaddr_add "$lan_mac" 1) - ucidef_add_switch "switch0" \ - "2:lan:2" "4:lan:1" "6t@eth0" - ;; -arcadyan,vgv7510kw22-brn|\ -arcadyan,vgv7510kw22-nor) - annex="b" - wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 0x16)" 2) - ucidef_add_switch "switch0" \ - "2:lan:2" "3:lan:1" "4:lan:4" "5:lan:3" "0:wan:5" "6t@eth0" - ;; -arcadyan,vgv7519-brn|\ -arcadyan,vgv7519-nor) - wan_mac=$(mtd_get_mac_binary board_config 0x16) - ucidef_add_switch "switch0" \ - "0:lan:4" "1:lan:3" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0" - ;; -avm,fritz3370-rev2-hynix|\ -avm,fritz3370-rev2-micron) - annex="b" - lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)")) - wan_mac=$(macaddr_add "$lan_mac" 3) - ucidef_add_switch "switch0" \ - "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0" - ;; -avm,fritz7360sl) - annex="b" - wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 0xa91)" 1) - ucidef_add_switch "switch0" \ - "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0" - ;; -avm,fritz7362sl) - annex="b" - lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)")) - wan_mac=$(fritz_tffs -n macdsl -i $(find_mtd_part "tffs (1)")) - ucidef_add_switch "switch0" \ - "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0" - ;; -avm,fritz7412) - tffsdev=$(find_mtd_chardev "nand-tffs") - annex="b" - lan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n maca -o) - wan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n macdsl -o) - ucidef_set_interface_lan 'eth0' - ;; -bt,homehub-v5a) - lan_mac=$(mtd_get_mac_binary_ubi caldata 0x110c) - wan_mac=$(macaddr_add "$lan_mac" 1) - ucidef_add_switch "switch0" \ - "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0" - ;; -buffalo,wbmr-300hpd) - lan_mac=$(mtd_get_mac_ascii ubootconfig ethaddr) - wan_mac="$lan_mac" - ucidef_add_switch "switch0" \ - "5:lan:2" "2:lan:3" "3:lan:4" "4:wan:1" "6t@eth0" - ;; -lantiq,easy80920-nand|\ -lantiq,easy80920-nor) - lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr) - wan_mac=$(macaddr_add "$lan_mac" 1) - ucidef_add_switch "switch0" \ - "0:lan:4" "1:lan:3" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0" - ;; -netgear,dm200) - lan_mac=$(mtd_get_mac_binary ART 0x0) - wan_mac=$(macaddr_add "$lan_mac" 1) - ucidef_set_interface_lan 'eth0' - ;; -tplink,tdw8970|\ -tplink,tdw8980) - wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0xf100)" 1) - ucidef_add_switch "switch0" \ - "0:lan:2" "2:lan:3" "4:lan:4" "5:lan:1" "6t@eth0" - ;; -tplink,vr200|\ -tplink,vr200v) - wan_mac=$(macaddr_add "$(mtd_get_mac_binary romfile 0xf100)" 1) - ucidef_add_switch "switch0" \ - "0:lan" "2:lan" "4:lan" "5:lan" "6t@eth0" - ;; -zyxel,p-2812hnu-f1|\ -zyxel,p-2812hnu-f3) - lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr) - wan_mac=$(macaddr_add "$lan_mac" 1) - ucidef_add_switch "switch0" \ - "0:lan" "1:lan" "2:lan" "4:lan" "5:wan" "6t@eth0" - ;; -*) - ucidef_set_interface_lan 'eth0' - ;; -esac +lantiq_setup_macs() +{ + local board="$1" + local lan_mac="" + local wan_mac="" -lantiq_setup_dsl_helper "$annex" + case "$board" in + alphanetworks,asl56026) + lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr) + wan_mac=$(mtd_get_mac_ascii uboot_env wanmac) + ;; + arcadyan,arv7519rw22) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0x16)" 1) + ;; + arcadyan,vg3503j|\ + lantiq,easy80920-nand|\ + lantiq,easy80920-nor|\ + zyxel,p-2812hnu-f1|\ + zyxel,p-2812hnu-f3) + lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr) + wan_mac=$(macaddr_add "$lan_mac" 1) + ;; + arcadyan,vgv7510kw22-brn|\ + arcadyan,vgv7510kw22-nor) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 0x16)" 2) + ;; + arcadyan,vgv7519-brn|\ + arcadyan,vgv7519-nor) + wan_mac=$(mtd_get_mac_binary board_config 0x16) + ;; + avm,fritz3370-rev2-hynix|\ + avm,fritz3370-rev2-micron) + lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)")) + wan_mac=$(macaddr_add "$lan_mac" 3) + ;; + avm,fritz7360sl) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 0xa91)" 1) + ;; + avm,fritz7362sl) + lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)")) + wan_mac=$(fritz_tffs -n macdsl -i $(find_mtd_part "tffs (1)")) + ;; + avm,fritz7412) + tffsdev=$(find_mtd_chardev "nand-tffs") + lan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n maca -o) + wan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n macdsl -o) + ;; + bt,homehub-v5a) + lan_mac=$(mtd_get_mac_binary_ubi caldata 0x110c) + wan_mac=$(macaddr_add "$lan_mac" 1) + ;; + buffalo,wbmr-300hpd) + lan_mac=$(mtd_get_mac_ascii ubootconfig ethaddr) + wan_mac="$lan_mac" + ;; + netgear,dm200) + lan_mac=$(mtd_get_mac_binary ART 0x0) + wan_mac=$(macaddr_add "$lan_mac" 1) + ;; + tplink,tdw8970|\ + tplink,tdw8980) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0xf100)" 1) + ;; + tplink,vr200|\ + tplink,vr200v) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary romfile 0xf100)" 1) + ;; + esac -[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac" -[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac" + [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac" + [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac" +} +board_config_update +board=$(board_name) +lantiq_setup_interfaces $board +lantiq_setup_dsl $board +lantiq_setup_macs $board board_config_flush exit 0 - diff --git a/target/linux/lantiq/xway/base-files/etc/board.d/02_network b/target/linux/lantiq/xway/base-files/etc/board.d/02_network index 71d36696db..89368d8bfb 100755 --- a/target/linux/lantiq/xway/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/xway/base-files/etc/board.d/02_network @@ -7,107 +7,112 @@ . /lib/functions/system.sh . /lib/functions/lantiq.sh -board_config_update +lantiq_setup_interfaces() +{ + local board="$1" -annex="a" + case "$board" in + arcadyan,arv4510pw) + ucidef_add_switch "switch0" \ + "0:lan:4" "2:lan:2" "1:lan:3" "3:lan:1" "5t@eth0" + ;; + arcadyan,arv4519pw|\ + arcadyan,arv7510pw22|\ + arcadyan,arv7518pw|\ + arcadyan,arv752dpw22|\ + arcadyan,arv8539pw22|\ + buffalo,wbmr-hp-g300h) + ucidef_add_switch "switch0" \ + "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan" + ;; + arcadyan,arv7506pw11|\ + audiocodes,mp-252|\ + siemens,gigaset-sx76x) + ucidef_add_switch "switch0" \ + "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0" + ;; + arcadyan,arv7519pw|\ + zte,h201l) + ucidef_add_switch "switch0" \ + "0:lan" "1:lan" "2:lan" "3:lan" "4t@eth0" + ;; + bt,homehub-v2b) + ucidef_add_switch "switch0" \ + "1:lan" "2:lan" "3:lan" "4:lan" "5t@eth0" + ;; + netgear,dgn3500|\ + netgear,dgn3500b) + ucidef_add_switch "switch0" \ + "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5t@eth0" + ;; + zyxel,p-2601hn) + ucidef_add_switch "switch0" \ + "0:lan" "1:lan" "2:lan" "3:lan" "5t@eth0" + ;; + *) + ucidef_set_interface_lan 'eth0' + ;; + esac +} -lan_mac="" -wan_mac="" +lantiq_setup_dsl() +{ + local board="$1" + local annex="a" -board=$(board_name) + case "$board" in + arcadyan,arv7506pw11|\ + arcadyan,arv7525pw|\ + arcadyan,arv752dpw|\ + arcadyan,arv752dpw22|\ + arcadyan,arv8539pw22|\ + avm,fritz7312|\ + avm,fritz7320|\ + siemens,gigaset-sx76x|\ + zte,h201l) + annex="b" + ;; + esac + + lantiq_setup_dsl_helper "$annex" +} -case "$board" in -arcadyan,arv4510pw) - lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr) - wan_mac=$(macaddr_add "$lan_mac" 1) - ucidef_add_switch "switch0" \ - "0:lan:4" "2:lan:2" "1:lan:3" "3:lan:1" "5t@eth0" - ;; -arcadyan,arv4519pw|\ -arcadyan,arv7510pw22|\ -arcadyan,arv7518pw) - ucidef_add_switch "switch0" \ - "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan" - ;; -arcadyan,arv7506pw11) - annex="b" - wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 0x16)" 2) - ucidef_add_switch "switch0" \ - "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0" - ;; -arcadyan,arv7519pw) - wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 0x16)" 1) - ucidef_add_switch "switch0" \ - "0:lan" "1:lan" "2:lan" "3:lan" "4t@eth0" - ;; -arcadyan,arv7525pw|\ -arcadyan,arv752dpw) - annex="b" - ucidef_set_interface_lan 'eth0' - ;; -arcadyan,arv752dpw22|\ -arcadyan,arv8539pw22) - annex="b" - ucidef_add_switch "switch0" \ - "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan" - ;; -audiocodes,mp-252) - ucidef_add_switch "switch0" \ - "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0" - ;; -avm,fritz7312|\ -avm,fritz7320) - annex="b" - wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 0xa91)" 1) - ucidef_set_interface_lan 'eth0' - ;; -bt,homehub-v2b) - lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr) - wan_mac=$(macaddr_add "$lan_mac" 1) - ucidef_add_switch "switch0" \ - "1:lan" "2:lan" "3:lan" "4:lan" "5t@eth0" - ;; -bt,homehub-v3a) - lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr) - wan_mac=$(macaddr_add "$lan_mac" 1) - ucidef_set_interface_lan 'eth0' - ;; -buffalo,wbmr-hp-g300h) - ucidef_add_switch "switch0" \ - "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan" - ;; -netgear,dgn3500|\ -netgear,dgn3500b) - lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr) - wan_mac=$(macaddr_add "$lan_mac" 1) - ucidef_add_switch "switch0" \ - "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5t@eth0" - ;; -siemens,gigaset-sx76x) - annex="b" - ucidef_add_switch "switch0" \ - "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0" - ;; -zte,h201l) - annex="b" - ucidef_add_switch "switch0" \ - "0:lan" "1:lan" "2:lan" "3:lan" "4t@eth0" - ;; -zyxel,p-2601hn) - ucidef_add_switch "switch0" \ - "0:lan" "1:lan" "2:lan" "3:lan" "5t@eth0" - ;; -*) - ucidef_set_interface_lan 'eth0' - ;; -esac +lantiq_setup_macs() +{ + local board="$1" + local lan_mac="" + local wan_mac="" -lantiq_setup_dsl_helper "$annex" + case "$board" in + arcadyan,arv4510pw|\ + bt,homehub-v2b|\ + bt,homehub-v3a|\ + netgear,dgn3500|\ + netgear,dgn3500b) + lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr) + wan_mac=$(macaddr_add "$lan_mac" 1) + ;; + arcadyan,arv7506pw11) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 0x16)" 2) + ;; + arcadyan,arv7519pw) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 0x16)" 1) + ;; + avm,fritz7312|\ + avm,fritz7320) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 0xa91)" 1) + ;; + esac -[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac" -[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac" + [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac" + [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac" +} +board_config_update +board=$(board_name) +lantiq_setup_interfaces $board +lantiq_setup_dsl $board +lantiq_setup_macs $board board_config_flush exit 0 - diff --git a/target/linux/lantiq/xway_legacy/base-files/etc/board.d/02_network b/target/linux/lantiq/xway_legacy/base-files/etc/board.d/02_network index 2d5dbade62..c29beb832d 100755 --- a/target/linux/lantiq/xway_legacy/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/xway_legacy/base-files/etc/board.d/02_network @@ -7,37 +7,55 @@ . /lib/functions/system.sh . /lib/functions/lantiq.sh -board_config_update - -annex="a" - -lan_mac="" -wan_mac="" +lantiq_setup_interfaces() +{ + local board="$1" + + case "$board" in + arcadyan,arv4520pw) + ucidef_add_switch "switch0" \ + "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5t@eth0" + ;; + *) + ucidef_set_interface_lan 'eth0' + ;; + esac +} + +lantiq_setup_dsl() +{ + local board="$1" + local annex="a" + + case "$board" in + arcadyan,arv4520pw|\ + arcadyan,arv4525pw|\ + arcadyan,arv452cqw) + annex="b" + ;; + esac + + lantiq_setup_dsl_helper "$annex" +} + +lantiq_setup_macs() +{ + local board="$1" + local lan_mac="" + local wan_mac="" + + case "$board" in + esac + + [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac" + [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac" +} +board_config_update board=$(board_name) - -case "$board" in -arcadyan,arv4520pw) - annex="b" - ucidef_add_switch "switch0" \ - "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5t@eth0" - ;; -arcadyan,arv4525pw|\ -arcadyan,arv452cqw) - annex="b" - ucidef_set_interface_lan 'eth0' - ;; -*) - ucidef_set_interface_lan 'eth0' - ;; -esac - -lantiq_setup_dsl_helper "$annex" - -[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac" -[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac" - +lantiq_setup_interfaces $board +lantiq_setup_dsl $board +lantiq_setup_macs $board board_config_flush exit 0 - -- 2.25.1