aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ipq40xx/base-files/etc
diff options
context:
space:
mode:
authorChristian Lamparter <chunkeey@gmail.com>2019-01-31 22:23:53 +0100
committerChristian Lamparter <chunkeey@gmail.com>2019-02-05 16:28:12 +0100
commit775258c128dc4f7268858717dc9400d28b469c96 (patch)
treebbe8457342eb70381dddc90a7c668a3b7f41fd50 /target/linux/ipq40xx/base-files/etc
parent65f9e5252678e748215a34b5ad73f03bccf6d3bc (diff)
downloadupstream-775258c128dc4f7268858717dc9400d28b469c96.tar.gz
upstream-775258c128dc4f7268858717dc9400d28b469c96.tar.bz2
upstream-775258c128dc4f7268858717dc9400d28b469c96.zip
ipq40xx: consolidate 02_network board defaults
This patch splits the big board case switch in 02_network in two functions ipq40xx_setup_interfaces() and ipq40xx_setup_macs() just like ath79 and ramips do. Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Diffstat (limited to 'target/linux/ipq40xx/base-files/etc')
-rwxr-xr-xtarget/linux/ipq40xx/base-files/etc/board.d/02_network124
1 files changed, 66 insertions, 58 deletions
diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network
index 7b9719848e..f9dd0f7d07 100755
--- a/target/linux/ipq40xx/base-files/etc/board.d/02_network
+++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network
@@ -7,67 +7,75 @@
. /lib/functions/uci-defaults.sh
. /lib/functions/system.sh
-board_config_update
+ipq40xx_setup_interfaces()
+{
+ local board="$1"
-board=$(board_name)
+ case "$board" in
+ 8dev,jalapeno)
+ ucidef_set_interfaces_lan_wan "eth0" "eth1"
+ ;;
+ asus,rt-ac58u|\
+ avm,fritzbox-4040|\
+ linksys,ea6350v3)
+ ucidef_set_interfaces_lan_wan "eth0" "eth1"
+ ucidef_add_switch "switch0" \
+ "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
+ ;;
+ compex,wpj428)
+ ucidef_set_interface_lan "eth0 eth1"
+ ;;
+ engenius,eap1300|\
+ meraki,mr33|\
+ netgear,ex6100v2|\
+ netgear,ex6150v2|\
+ zyxel,wre6606)
+ ucidef_set_interface_lan "eth0"
+ ;;
+ glinet,gl-b1300)
+ ucidef_set_interfaces_lan_wan "eth0" "eth1"
+ ucidef_add_switch "switch0" \
+ "0u@eth0" "3:lan" "4:lan"
+ ;;
+ openmesh,a42|\
+ openmesh,a62)
+ ucidef_set_interfaces_lan_wan "eth1" "eth0"
+ ;;
+ zyxel,nbg6617)
+ ucidef_set_interfaces_lan_wan "eth0" "eth1"
+ ucidef_add_switch "switch0" \
+ "0u@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
+ ;;
+ *)
+ echo "Unsupported hardware. Network interfaces not initialized"
+ ;;
+ esac
+}
+
+ipq40xx_setup_macs()
+{
+ local board="$1"
-case "$board" in
-8dev,jalapeno)
- ucidef_set_interfaces_lan_wan "eth0" "eth1"
- ;;
-asus,rt-ac58u)
- CI_UBIPART=UBI_DEV
- wan_mac_addr=$(mtd_get_mac_binary_ubi Factory 20486)
- lan_mac_addr=$(mtd_get_mac_binary_ubi Factory 4102)
- ucidef_set_interfaces_lan_wan "eth0" "eth1"
- ucidef_add_switch "switch0" \
- "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
- ucidef_set_interface_macaddr "lan" "$lan_mac_addr"
- ucidef_set_interface_macaddr "wan" "$wan_mac_addr"
- ;;
-avm,fritzbox-4040)
- ucidef_set_interfaces_lan_wan "eth0" "eth1"
- ucidef_add_switch "switch0" \
- "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
- ;;
-compex,wpj428)
- ucidef_set_interface_lan "eth0 eth1"
- ;;
-engenius,eap1300 |\
-meraki,mr33 |\
-netgear,ex6100v2 |\
-netgear,ex6150v2 |\
-zyxel,wre6606)
- ucidef_set_interface_lan "eth0"
- ;;
-glinet,gl-b1300)
- ucidef_set_interfaces_lan_wan "eth0" "eth1"
- ucidef_add_switch "switch0" \
- "0u@eth0" "3:lan" "4:lan"
- ;;
-linksys,ea6350v3)
- wan_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
- lan_mac_addr=$(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) +1)
- ucidef_set_interfaces_lan_wan "eth0" "eth1"
- ucidef_add_switch "switch0" \
- "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
- ucidef_set_interface_macaddr "wan" "$wan_mac_addr"
- ucidef_set_interface_macaddr "lan" "$lan_mac_addr"
- ;;
-openmesh,a42 |\
-openmesh,a62)
- ucidef_set_interfaces_lan_wan "eth1" "eth0"
- ;;
-zyxel,nbg6617)
- ucidef_set_interfaces_lan_wan "eth0" "eth1"
- ucidef_add_switch "switch0" \
- "0u@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
- ;;
-*)
- echo "Unsupported hardware. Network interfaces not intialized"
- ;;
-esac
+ case "$board" in
+ asus,rt-ac58u)
+ CI_UBIPART=UBI_DEV
+ wan_mac=$(mtd_get_mac_binary_ubi Factory 20486)
+ lan_mac=$(mtd_get_mac_binary_ubi Factory 4102)
+ ;;
+ linksys,ea6350v3)
+ wan_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
+ lan_mac=$(macaddr_add $(wan_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)
+ipq40xx_setup_interfaces $board
+ipq40xx_setup_macs $board
board_config_flush
exit 0