summaryrefslogtreecommitdiffstats
path: root/target/linux/mediatek/mt7629/base-files/etc/board.d/02_network
blob: df042f8ad27d4f87747c325426287e8b2121b9c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

. /lib/functions.sh
. /lib/functions/uci-defaults.sh
. /lib/functions/system.sh

mediatek_setup_interfaces()
{
	local board="$1"

	case $board in
	iptime,a6004mx)
		ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "eth1"
		;;
	mediatek,mt7629-rfb)
		ucidef_set_interface_wan "eth1"
		ucidef_add_switch "switch0" \
			"0:lan" "1:lan" "2:lan" "3:lan" "6@eth0"
		;;
	netgear,ex6250-v2|\
	tplink,eap225-v5)
		ucidef_set_interface_lan "eth0"
		;;
	esac
}

mediatek_setup_macs()
{
	local board="$1"

	case $board in
	netgear,ex6250-v2)
		lan_mac=$(mtd_get_mac_ascii Config mac)
		label_mac=$lan_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)
mediatek_setup_interfaces $board
mediatek_setup_macs $board
board_config_flush

exit 0