lede/target/linux/ipq807x/base-files/etc/board.d/02_network
2023-03-01 12:52:55 +08:00

64 lines
1.3 KiB
Plaintext

#
# Copyright (c) 2015 The Linux Foundation. All rights reserved.
# Copyright (c) 2011-2015 OpenWrt.org
#
. /lib/functions/uci-defaults.sh
. /lib/functions/system.sh
ipq807x_setup_interfaces()
{
local board="$1"
case "$board" in
zyxel,nbg7815|\
qnap,301w)
ucidef_set_interfaces_lan_wan "eth0 eth1 eth2 eth3 eth4" "eth5"
;;
redmi,ax6|\
xiaomi,ax3600)
ucidef_set_interfaces_lan_wan "eth1 eth2 eth3" "eth0"
;;
zte,mf269)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
;;
tplink,tl-er2260t)
ucidef_set_interfaces_lan_wan "eth0 eth1 eth2 eth3 eth5" "eth4"
;;
tplink,xtr10890)
ucidef_set_interfaces_lan_wan "eth0 eth1 eth2 eth3 eth4" "eth5"
;;
*)
echo "Unsupported hardware. Network interfaces not initialized"
;;
esac
}
ipq807x_setup_macs()
{
local board="$1"
local lan_mac=""
local wan_mac=""
local label_mac=""
case "$board" in
zte,mf269)
wan_mac=$(mtd_get_mac_binary mac 0x0)
lan_mac=$(macaddr_add "$wan_mac" 1)
label_mac=$wan_mac
;;
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)
ipq807x_setup_interfaces $board
ipq807x_setup_macs $board
board_config_flush
exit 0