2 # Copyright (c) 2015 The Linux Foundation. All rights reserved.
3 # Copyright (c) 2011-2015 OpenWrt.org
6 . /lib/functions/uci-defaults.sh
7 . /lib/functions/system.sh
9 ipq40xx_setup_interfaces()
16 alfa-network,ap120c-ac|\
23 ucidef_set_interfaces_lan_wan "eth0" "eth1"
27 avm,fritzrepeater-1200|\
38 ucidef_set_interface_lan "eth0"
42 ucidef_set_interfaces_lan_wan "eth0" "eth1"
43 ucidef_add_switch "switch0" \
44 "0u@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "0u@eth1" "5:wan"
53 ucidef_set_interfaces_lan_wan "eth1" "eth0"
56 ucidef_add_switch "switch0" \
57 "0t@eth0" "4:lan" "5:wan"
66 ucidef_set_interfaces_lan_wan "eth0" "eth1"
67 ucidef_add_switch "switch0" \
68 "0u@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
73 ucidef_set_interfaces_lan_wan "eth0" "eth1"
74 ucidef_add_switch "switch0" \
75 "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
78 ucidef_set_interfaces_lan_wan "eth0" "eth1"
79 ucidef_add_switch "switch0" \
80 "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan"
83 ucidef_add_switch "switch0" \
84 "0u@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
86 avm,fritzrepeater-3000|\
88 ucidef_add_switch "switch0" \
89 "0u@eth0" "4:lan:1" "5:lan:2"
94 ucidef_set_interface_lan "eth0 eth1"
97 ucidef_set_interfaces_lan_wan "eth0" "eth1"
98 ucidef_add_switch "switch0" \
99 "0u@eth0" "2:lan:3" "3:lan:2" "4:lan:1"
102 ucidef_set_interface_lan "eth0"
103 ucidef_add_switch "switch0" \
104 "0u@eth0" "3:lan" "4:lan"
106 devolo,magic-2-wifi-next)
107 ucidef_set_interface_lan "eth0 eth1 eth2"
109 ezviz,cs-w3-wd1200g-eup)
110 ucidef_set_interfaces_lan_wan "eth0" "eth1"
111 ucidef_add_switch "switch0" \
112 "0u@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "0u@eth1" "5:wan"
117 ucidef_set_interfaces_lan_wan "eth0" "eth1"
118 ucidef_add_switch "switch0" \
119 "0u@eth0" "3:lan" "4:lan"
122 ucidef_set_interfaces_lan_wan "eth0" "eth1"
123 ucidef_add_switch "switch0" \
124 "0u@eth0" "1:lan" "2:lan" "3:lan" "5:lan" "0u@eth1" "4:wan"
127 ucidef_add_switch "switch0" \
128 "0u@eth0" "3:lan:2" "4:lan:1"
129 ucidef_set_interface_wan "eth1"
135 ucidef_add_switch "switch0" \
136 "0u@eth0" "2:lan" "3:lan" "4:lan"
137 ucidef_set_interface_wan "eth1"
141 ucidef_set_interfaces_lan_wan "eth0" "eth1"
142 ucidef_add_switch "switch0" \
143 "0u@eth0" "3:lan" "4:lan" "0u@eth1" "5:wan"
147 ucidef_set_interfaces_lan_wan "eth0" "eth1"
148 ucidef_add_switch "switch0" \
149 "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan"
152 ucidef_set_interfaces_lan_wan "eth0" "eth1"
153 ucidef_add_switch "switch0" \
154 "0u@eth0" "2:lan:4" "3:lan:3" "4:lan:2" "0u@eth1" "5:wan"
157 echo "Unsupported hardware. Network interfaces not initialized"
171 label_mac=$(mtd_get_mac_binary "ART" 0x1006)
174 wan_mac=$(mtd_get_mac_binary_ubi Factory 0x1006)
175 lan_mac=$(mtd_get_mac_binary_ubi Factory 0x5006)
179 label_mac=$(mtd_get_mac_binary "ART" 0x1006)
181 devolo,magic-2-wifi-next)
182 lan_mac=$(mtd_get_mac_ascii APPSBLENV MacAddress0)
186 lan_mac=$(mtd_get_mac_ascii bdcfg lanmac)
191 lan_mac=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
195 wan_mac=$(mtd_get_mac_ascii 0:APPSBLENV wanaddr)
196 lan_mac=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
200 wan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
201 lan_mac=$(macaddr_add "$wan_mac" 1)
203 ezviz,cs-w3-wd1200g-eup)
204 label_mac=$(mtd_get_mac_binary "ART" 0x6)
207 wan_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
208 lan_mac=$(macaddr_add "$wan_mac" 1)
213 wan_mac=$(cat /sys/firmware/mikrotik/hard_config/mac_base)
214 lan_mac=$(macaddr_add $wan_mac 1)
219 lan_mac=$(cat /sys/firmware/mikrotik/hard_config/mac_base)
224 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
225 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
226 [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
231 ipq40xx_setup_interfaces $board
232 ipq40xx_setup_macs $board