diff options
author | Adrian Schmutzler <freifunk@adrianschmutzler.de> | 2019-12-17 14:37:26 +0100 |
---|---|---|
committer | Adrian Schmutzler <freifunk@adrianschmutzler.de> | 2020-01-14 22:04:44 +0100 |
commit | 2fe464a712f8da597475d63a0ad28ec678eb404a (patch) | |
tree | 8dd8bdff4c78a56d63b2c4ea38c519ff49b28aad /target/linux/lantiq/xway_legacy/base-files/etc/board.d | |
parent | 18e089aaed58cb474c40b63da8562d7805f8b776 (diff) | |
download | upstream-2fe464a712f8da597475d63a0ad28ec678eb404a.tar.gz upstream-2fe464a712f8da597475d63a0ad28ec678eb404a.tar.bz2 upstream-2fe464a712f8da597475d63a0ad28ec678eb404a.zip |
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 <freifunk@adrianschmutzler.de>
Diffstat (limited to 'target/linux/lantiq/xway_legacy/base-files/etc/board.d')
-rwxr-xr-x | target/linux/lantiq/xway_legacy/base-files/etc/board.d/02_network | 76 |
1 files changed, 47 insertions, 29 deletions
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 - |