ipq806x: reorganize 02_network board.d script

Reorganize 02_network board.d script by splitting setup switch and setup
mac address.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
Christian Marangi 2023-07-16 03:02:15 +02:00
parent 0f1cd99b36
commit 548c437f7d
No known key found for this signature in database
GPG Key ID: AC001D09ADBFEAD7

View File

@ -6,9 +6,9 @@
. /lib/functions/uci-defaults.sh
. /lib/functions/system.sh
board_config_update
board=$(board_name)
ipq806x_setup_interfaces()
{
local board="$1"
case "$board" in
arris,tr4400-v2)
@ -35,18 +35,12 @@ edgecore,ecw5410)
ucidef_set_interfaces_lan_wan "eth1" "eth0"
;;
linksys,ea7500-v1)
hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
ucidef_add_switch "switch0" \
"2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "6@eth1" "1:wan" "0@eth0"
ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
;;
linksys,ea8500)
hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
;;
meraki,mr42)
ucidef_set_interface_lan "eth0"
@ -91,16 +85,44 @@ ubnt,unifi-ac-hd)
ucidef_set_interface_lan "eth0 eth1"
;;
zyxel,nbg6817)
hw_mac_addr=$(mtd_get_mac_ascii 0:appsblenv ethaddr)
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
ucidef_set_interface_macaddr "lan" "$(macaddr_add $hw_mac_addr 2)"
ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 3)"
;;
*)
echo "Unsupported hardware. Network interfaces not intialized"
;;
esac
}
ipq806x_setup_mac_address()
{
local board="$1"
case "$board" in
linksys,ea7500-v1)
hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
;;
linksys,ea8500)
hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
;;
zyxel,nbg6817)
hw_mac_addr=$(mtd_get_mac_ascii 0:appsblenv ethaddr)
ucidef_set_interface_macaddr "lan" "$(macaddr_add $hw_mac_addr 2)"
ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 3)"
;;
esac
}
board_config_update
board=$(board_name)
ipq806x_setup_mac_address $board
ipq806x_setup_interfaces $board
board_config_flush