aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorSungbo Eo <mans0n@gorani.run>2022-01-22 20:30:05 +0900
committerSungbo Eo <mans0n@gorani.run>2022-01-29 23:50:28 +0900
commit0c568d044fac166e803ab6a9bcd2f18d31309f9f (patch)
tree2f344c9e66af7e6803bbe1787ac04cc82cac8559 /target/linux
parentaaebc7aa2eff9a0bb9e843e472cb2eb94022f12e (diff)
downloadupstream-0c568d044fac166e803ab6a9bcd2f18d31309f9f.tar.gz
upstream-0c568d044fac166e803ab6a9bcd2f18d31309f9f.tar.bz2
upstream-0c568d044fac166e803ab6a9bcd2f18d31309f9f.zip
kirkwood: rework 02_network
Just like other targets do, introduce two setup functions for interfaces and MAC addresses. Signed-off-by: Sungbo Eo <mans0n@gorani.run>
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/kirkwood/base-files/etc/board.d/02_network109
1 files changed, 67 insertions, 42 deletions
diff --git a/target/linux/kirkwood/base-files/etc/board.d/02_network b/target/linux/kirkwood/base-files/etc/board.d/02_network
index ebc70cfc2f..773730e642 100644
--- a/target/linux/kirkwood/base-files/etc/board.d/02_network
+++ b/target/linux/kirkwood/base-files/etc/board.d/02_network
@@ -5,51 +5,76 @@
. /lib/functions/uci-defaults.sh
. /lib/functions/system.sh
-board_config_update
+kirkwood_setup_interfaces()
+{
+ local board="$1"
-board=$(board_name)
+ case "$board" in
+ checkpoint,l-50)
+ ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5 lan6 lan7 lan8 dmz" "eth0"
+ ;;
+ cisco,on100)
+ ucidef_set_interface_lan "eth0 eth1"
+ ;;
+ cloudengines,pogoe02|\
+ cloudengines,pogoplugv4|\
+ ctera,c200-v1|\
+ globalscale,sheevaplug|\
+ iom,iconnect-1.1|\
+ iom,ix2-200|\
+ netgear,readynas-duo-v2|\
+ raidsonic,ib-nas62x0|\
+ seagate,blackarmor-nas220|\
+ seagate,dockstar|\
+ seagate,goflexhome|\
+ seagate,goflexnet|\
+ zyxel,nsa310b|\
+ zyxel,nsa310s|\
+ zyxel,nsa325)
+ ucidef_set_interface_lan "eth0" "dhcp"
+ ;;
+ endian,4i-edge-200)
+ ucidef_set_interface_lan "port1 port2 port3 port4 eth1"
+ ;;
+ linksys,e4200-v2|\
+ linksys,ea3500|\
+ linksys,ea4500)
+ ucidef_set_interfaces_lan_wan "ethernet1 ethernet2 ethernet3 ethernet4" "internet"
+ ;;
+ *)
+ ucidef_set_interface_lan "eth0"
+ ;;
+ esac
+}
+
+kirkwood_setup_macs()
+{
+ local board="$1"
+ local lan_mac=""
+ local wan_mac=""
+ local label_mac=""
-case "$board" in
-checkpoint,l-50)
- ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5 lan6 lan7 lan8 dmz" "eth0"
- ;;
-cisco,on100)
- ucidef_set_interface_lan "eth0 eth1"
- ;;
-cloudengines,pogoe02|\
-cloudengines,pogoplugv4|\
-ctera,c200-v1|\
-globalscale,sheevaplug|\
-iom,iconnect-1.1|\
-iom,ix2-200|\
-netgear,readynas-duo-v2|\
-raidsonic,ib-nas62x0|\
-seagate,blackarmor-nas220|\
-seagate,dockstar|\
-seagate,goflexhome|\
-seagate,goflexnet|\
-zyxel,nsa310s)
- ucidef_set_interface_lan "eth0" "dhcp"
- ;;
-endian,4i-edge-200)
- ucidef_set_interface_lan "port1 port2 port3 port4 eth1"
- ;;
-linksys,e4200-v2|\
-linksys,ea3500|\
-linksys,ea4500)
- ucidef_set_interfaces_lan_wan "ethernet1 ethernet2 ethernet3 ethernet4" "internet"
- ucidef_set_interface_macaddr "wan" $( mtd_get_mac_ascii u_env eth1addr )
- ;;
-zyxel,nsa310b|\
-zyxel,nsa325)
- ucidef_set_interface_lan "eth0" "dhcp"
- ucidef_set_interface_macaddr "lan" $( mtd_get_mac_ascii uboot_env ethaddr )
- ;;
-*)
- ucidef_set_interface_lan "eth0"
- ;;
-esac
+ case "$board" in
+ linksys,e4200-v2|\
+ linksys,ea3500|\
+ linksys,ea4500)
+ wan_mac=$(mtd_get_mac_ascii u_env eth1addr)
+ ;;
+ zyxel,nsa310b|\
+ zyxel,nsa325)
+ lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
+ ;;
+ esac
+ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
+ [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
+ [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
+}
+
+board_config_update
+board=$(board_name)
+kirkwood_setup_interfaces $board
+kirkwood_setup_macs $board
board_config_flush
exit 0