2 # Copyright (C) 2014-2015 OpenWrt.org
3 # Copyright (C) 2016 LEDE-Project.org
6 preinit_set_mac_address() {
13 mac=$(mtd_get_mac_ascii u-boot-env eth1addr)
14 ip link set dev eth0 address $mac 2>/dev/null
16 linksys,caiman|linksys,cobra|linksys,rango|linksys,shelby|linksys,venom)
17 # rename interfaces back to the way they were with 4.4
18 case "$(readlink /sys/class/net/eth0)" in
20 ip link set eth0 name tmp0
21 ip link set eth1 name eth0
22 ip link set tmp0 name eth1
26 mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
27 mac_wan=$(macaddr_setbit_la "$mac")
28 ip link set dev eth0 address $mac 2>/dev/null
29 ip link set dev eth1 address $mac_wan 2>/dev/null
32 mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
33 ip link set dev eth0 address $mac 2>/dev/null
34 ip link set dev eth1 address $mac 2>/dev/null
36 marvell,a385-db-ap|solidrun,clearfog*a1)
37 # rename interfaces back to the way they were with 4.4
38 case "$(readlink /sys/class/net/eth0)" in
40 ip link set eth0 name tmp0
41 ip link set eth1 name eth0
42 ip link set eth2 name eth1
43 ip link set tmp0 name eth2
50 boot_hook_add preinit_main preinit_set_mac_address