aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh
blob: b98b047c937194f1f1070062dc8a751c8d052643 (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
. /lib/functions/system.sh

preinit_set_mac_address() {
	case $(board_name) in
	avm,fritz1750e|\
	avm,fritz450e|\
	avm,fritzdvbc)
		ip link set dev eth0 address $(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
		;;
	dlink,dap-2695-a1|\
	dlink,dap-3662-a1)
		ip link set dev eth0 address $(mtd_get_mac_ascii bdcfg "lanmac")
		ip link set dev eth1 address $(mtd_get_mac_ascii bdcfg "wanmac")
		;;
	engenius,esr1750|\
	engenius,esr900)
		ip link set dev eth0 address $(mtd_get_mac_ascii u-boot-env ethaddr)
		;;
	enterasys,ws-ap3705i)
		ip link set dev eth0 address $(mtd_get_mac_ascii u-boot-env0 ethaddr)
		;;
	extreme-networks,ws-ap3805i|\
	siemens,ws-ap3610)
		ip link set dev eth0 address $(mtd_get_mac_ascii cfg1 ethaddr)
		;;
	fortinet,fap-221-b)
		ip link set dev eth0 address $(mtd_get_mac_text u-boot 0x3ff80 12)
		;;
	tplink,deco-s4-v2)
		base_mac=$(mtd_get_mac_encrypted_deco $(find_mtd_part config))
		ip link set dev eth0 address $base_mac
		;;
	zyxel,nbg6616)
		ethaddr=$(mtd_get_mac_ascii u-boot-env ethaddr)
		ip link set dev eth0 address $(macaddr_add $ethaddr 2)
		ip link set dev eth1 address $(macaddr_add $ethaddr 3)
		;;
	esac
}

boot_hook_add preinit_main preinit_set_mac_address