1 [ "$ACTION" == "add" ] || exit 0
3 PHYNBR=${DEVPATH##*/phy}
5 [ -n $PHYNBR ] || exit 0
8 . /lib/functions/system.sh
14 key_path="/var/qcidata/data"
15 [ "$PHYNBR" = "0" ] && cat $key_path/2gMAC > /sys${DEVPATH}/macaddress
16 [ "$PHYNBR" = "1" ] && cat $key_path/6gMAC > /sys${DEVPATH}/macaddress
17 [ "$PHYNBR" = "2" ] && cat $key_path/5gMAC > /sys${DEVPATH}/macaddress
21 addr=$(mtd_get_mac_binary_ubi "Factory" 0x4)
22 # Originally, phy1 is phy0 mac with LA and 28th bits set. However, this would conflict
23 # addresses on multiple VIFs with the other radio when bit 28 is already set.
24 # Set LA and 28 bits and increment mac-address instead.
25 [ "$PHYNBR" = "1" ] && \
26 macaddr_setbit_la $(macaddr_setbit $(macaddr_add $addr 1) 28) > \
27 /sys${DEVPATH}/macaddress
32 addr=$(mtd_get_mac_binary_ubi "Factory" 0x4)
33 # Originally, phy0 is phy1 mac with LA bit set. However, this would conflict
34 # addresses on multiple VIFs with the other radio. Set LA bit and increment
35 # mac-address instead.
36 [ "$PHYNBR" = "0" ] && macaddr_setbit_la $(macaddr_add $addr 1) > /sys${DEVPATH}/macaddress
37 [ "$PHYNBR" = "1" ] && echo "$addr" > /sys${DEVPATH}/macaddress
41 addr=$(cat /sys/class/net/eth0/address)
42 [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress
43 [ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress
46 addr=$(cat /sys/class/net/eth0/address)
47 [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress
48 [ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress
49 [ "$PHYNBR" = "2" ] && macaddr_add $addr 4 > /sys${DEVPATH}/macaddress
52 addr=$(mtd_get_mac_binary "art" 0)
53 [ "$PHYNBR" = "0" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress
54 [ "$PHYNBR" = "1" ] && macaddr_setbit_la $(macaddr_add $addr 2) > /sys${DEVPATH}/macaddress
57 case "$(cmdline_get_var root)" in
59 addr=$(mmc_get_mac_binary factory 0xa)
62 addr=$(mtd_get_mac_binary factory 0xa)
65 [ "$PHYNBR" = "1" ] && echo "$addr" > /sys${DEVPATH}/macaddress
68 addr=$(mtd_get_mac_binary "Factory" 0x8000)
69 [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress
72 addr=$(mtd_get_mac_binary bdinfo 0xde00)
73 [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress
74 [ "$PHYNBR" = "1" ] && macaddr_setbit_la $(macaddr_add $addr 1) > /sys${DEVPATH}/macaddress
77 addr=$(mtd_get_mac_binary bdinfo 0xde00)
78 # Originally, phy0 is phy1 mac with LA bit set. However, this would conflict
79 # addresses on multiple VIFs with the other radio. Set LA bit and increment
80 # mac-address instead.
81 [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress
82 [ "$PHYNBR" = "1" ] && macaddr_setbit_la $(macaddr_add $addr 1) > /sys${DEVPATH}/macaddress
84 dlink,aquila-pro-ai-m30-a1)
85 addr=$(mtd_get_mac_binary "Odm" 0x81)
86 [ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress
91 addr=$(mmc_get_mac_binary factory 0x04)
92 [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress
93 [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress
96 addr=$(mtd_get_mac_ascii pdt_data_1 ethaddr)
97 [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress
98 [ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress
102 # Originally, phy1 is phy0 mac with LA bit set. However, this would conflict
103 # addresses on multiple VIFs with the other radio. Use label mac to set LA bit.
104 [ "$PHYNBR" = "1" ] && macaddr_setbit_la $(get_mac_label) > /sys${DEVPATH}/macaddress
107 [ "$PHYNBR" = "1" ] && mmc_get_mac_binary factory 0xa > /sys${DEVPATH}/macaddress
110 addr=$(get_mac_binary "/tmp/tp_data/default-mac" 0)
111 [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress
112 [ "$PHYNBR" = "1" ] && macaddr_add $addr -1 > /sys${DEVPATH}/macaddress
115 hw_mac_addr=$(mtd_get_mac_ascii u-boot-env mac)
116 [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress
117 [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 3 > /sys${DEVPATH}/macaddress
120 [ "$PHYNBR" = "1" ] && cat /sys/class/net/eth0/address > /sys${DEVPATH}/macaddress
123 addr=$(mtd_get_mac_ascii factory lanMac)
124 [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress
125 [ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress
131 addr=$(mmc_get_mac_ascii mfginfo MFG_MAC)
132 [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress
133 [ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress
134 [ "$PHYNBR" = "2" ] && macaddr_add $addr 4 > /sys${DEVPATH}/macaddress
139 [ "$PHYNBR" = "0" ] && get_mac_label > /sys${DEVPATH}/macaddress
142 addr=$(mtd_get_mac_binary EEPROM 0x6)
143 [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress
144 [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress
147 zbtlink,zbt-z8102ax|\
148 zbtlink,zbt-z8103ax|\
150 zyxel,ex5601-t0-ubootmod)
151 addr=$(mtd_get_mac_binary "Factory" 0x4)
152 [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress
155 hw_mac_addr="$(mtd_get_mac_binary mrd 0x1fff8)"
156 [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress
157 [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress