mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-29 09:32:34 +00:00
64 lines
1.7 KiB
Bash
Executable File
64 lines
1.7 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
. /lib/functions/uci-defaults.sh
|
|
. /lib/functions.sh
|
|
. /lib/functions/system.sh
|
|
|
|
ipq53xx_setup_interfaces()
|
|
{
|
|
local board="$1"
|
|
|
|
case "$board" in
|
|
qcom,ipq9574-ap-al02-c4)
|
|
ucidef_set_interfaces_lan_wan "eth1 eth2 eth3 eth4 eth5" "eth0"
|
|
;;
|
|
|
|
cig,wf189|\
|
|
edgecore,eap105|\
|
|
sercomm,ap72tip)
|
|
ucidef_set_interfaces_lan_wan "eth1" "eth0"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
qcom_setup_macs()
|
|
{
|
|
local board="$1"
|
|
|
|
case $board in
|
|
cig,wf189)
|
|
mtd=$(find_mtd_chardev "0:APPSBLENV")
|
|
[ -z "$mtd" ] && return;
|
|
mac=$(grep eth1addr= $mtd | cut -d= -f2)
|
|
[ -z "$mac" ] && return;
|
|
wan_mac=$(macaddr_canonicalize $mac)
|
|
lan_mac=$(macaddr_add "$wan_mac" 1)
|
|
ucidef_set_network_device_mac eth0 $lan_mac
|
|
ucidef_set_network_device_mac eth1 $wan_mac
|
|
ucidef_set_label_macaddr $wan_mac
|
|
ucidef_set_wireless_macaddr_base 2g $(macaddr_add "$wan_mac" 2)
|
|
ucidef_set_wireless_macaddr_base 5g $(macaddr_add "$wan_mac" 3)
|
|
ucidef_set_wireless_macaddr_base 6g $(macaddr_add "$wan_mac" 4)
|
|
;;
|
|
edgecore,eap105)
|
|
wan_mac=$(cat /sys/class/net/eth0/address)
|
|
lan_mac=$(macaddr_add "$wan_mac" 1)
|
|
;;
|
|
*)
|
|
wan_mac=$(cat /sys/class/net/eth1/address)
|
|
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
|
|
[ -n "$wan_mac" ] && ucidef_set_label_macaddr "$wan_mac"
|
|
}
|
|
|
|
board_config_update
|
|
board=$(board_name)
|
|
ipq53xx_setup_interfaces $board
|
|
qcom_setup_macs $board
|
|
board_config_flush
|
|
|
|
exit 0
|