f1fcd96e21f182c66bb6353f9bd519fe336ba278
[openwrt/svn-archive/archive.git] / target / linux / ramips / base-files / lib / preinit / 06_set_iface_mac
1 #
2 # Copyright (C) 2011 OpenWrt.org
3 #
4
5 preinit_set_mac_address() {
6 local mac
7
8 . /lib/ramips.sh
9
10 case $(ramips_board_name) in
11 3g-6200n)
12 mac=$(ramips_get_mac_binary factory 4)
13 ifconfig eth0 hw ether $mac 2>/dev/null
14 ;;
15 bc2 |\
16 dir-620-a1 |\
17 esr-9753 |\
18 freestation5 |\
19 nw718 |\
20 psr-680w |\
21 rt-n56u |\
22 sl-r7205)
23 mac=$(ramips_get_mac_binary factory 4)
24 mac=$(maccalc or "$mac" "02:00:00:00:00:00")
25 ifconfig eth0 hw ether $mac 2>/dev/null
26 ;;
27 dir-300-b1 |\
28 dir-300-b2 |\
29 dir-600-b1)
30 mac=$(ramips_get_mac_binary devdata 16388)
31 ifconfig eth0 hw ether $mac 2>/dev/null
32 ;;
33 dir-645)
34 mac=$(ramips_get_mac_nvram nvram lanmac)
35 mac=$(maccalc or "$mac" "02:00:00:00:00:00")
36 ifconfig eth0 hw ether $mac 2>/dev/null
37 ;;
38 dap-1350)
39 mac=$(ramips_get_mac_binary devdata 46)
40 ifconfig eth0 hw ether $mac 2>/dev/null
41 ;;
42 all0239-3g |\
43 all0256n |\
44 all5002 |\
45 carambola |\
46 dir-615-h1 |\
47 fonera20n |\
48 hw550-3g |\
49 nbg-419n |\
50 omni-emb |\
51 tew-691gr |\
52 tew-692gr |\
53 w306r-v20 |\
54 w502u |\
55 wl-330n |\
56 wl-330n3g |\
57 wr6202 |\
58 xdxrn502j)
59 mac=$(ramips_get_mac_binary factory 40)
60 ifconfig eth0 hw ether $mac 2>/dev/null
61 ;;
62 wl341v3)
63 mac=$(ramips_get_mac_binary board-nvram 65440)
64 ifconfig eth0 hw ether $mac 2>/dev/null
65 ;;
66 rt-n10-plus)
67 mac=$(ramips_get_mac_binary devconf 4)
68 ifconfig eth0 hw ether $mac 2>/dev/null
69 ;;
70 esac
71 }
72
73 boot_hook_add preinit_main preinit_set_mac_address