aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSungbo Eo <mans0n@gorani.run>2020-03-16 02:42:38 +0900
committerSungbo Eo <mans0n@gorani.run>2020-03-16 17:16:39 +0900
commit8adcfe289ce5328ee1ff62fcfc8b244012738c50 (patch)
treeec2dfe58b88cbe0063baac66c616024722520ba3
parent9559a3304e5563c76c4a1c4901ab8ea3b6a8a5da (diff)
downloadupstream-8adcfe289ce5328ee1ff62fcfc8b244012738c50.tar.gz
upstream-8adcfe289ce5328ee1ff62fcfc8b244012738c50.tar.bz2
upstream-8adcfe289ce5328ee1ff62fcfc8b244012738c50.zip
oxnas: 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>
-rwxr-xr-xtarget/linux/oxnas/base-files/etc/board.d/02_network34
1 files changed, 25 insertions, 9 deletions
diff --git a/target/linux/oxnas/base-files/etc/board.d/02_network b/target/linux/oxnas/base-files/etc/board.d/02_network
index 7b657cd108..9ba2deb7b4 100755
--- a/target/linux/oxnas/base-files/etc/board.d/02_network
+++ b/target/linux/oxnas/base-files/etc/board.d/02_network
@@ -3,10 +3,6 @@
. /lib/functions/uci-defaults.sh
. /lib/functions/system.sh
-board_config_update
-
-lan_mac=""
-
bootloader_cmdline_var() {
local param
local pval
@@ -31,15 +27,35 @@ legacy_boot_mac_adr() {
IFS="$oIFS"
}
-case "$(board_name)" in
- "shuttle,kd20")
+oxnas_setup_interfaces()
+{
+ local board="$1"
+
+ case $board in
+ *)
+ ucidef_set_interface_lan "eth0" "dhcp"
+ ;;
+ esac
+}
+
+oxnas_setup_macs()
+{
+ local board="$1"
+ local lan_mac=""
+
+ case $board in
+ shuttle,kd20)
lan_mac="$(legacy_boot_mac_adr)"
;;
-esac
+ esac
-ucidef_set_interface_lan "eth0" "dhcp"
-[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
+ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
+}
+board_config_update
+board=$(board_name)
+oxnas_setup_interfaces $board
+oxnas_setup_macs $board
board_config_flush
exit 0