3 # Copyright (C) 2011-2015 OpenWrt.org
6 . /lib/functions/system.sh
7 . /lib/functions/uci-defaults.sh
10 ar71xx_setup_interfaces()
16 ucidef_add_switch "switch0" \
17 "0@eth0" "4:lan" "5:wan"
56 ucidef_set_interfaces_lan_wan "eth0" "eth1"
57 ucidef_add_switch "switch0" \
58 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
112 ucidef_set_interface_lan "eth0"
132 ucidef_set_interfaces_lan_wan "eth1" "eth0"
142 ucidef_set_interface_lan "eth0 eth1"
147 ucidef_add_switch "switch0" \
148 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
158 ucidef_add_switch "switch0" \
159 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
166 ucidef_set_interfaces_lan_wan "eth1" "eth0"
167 ucidef_add_switch "switch0" \
168 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
174 ucidef_set_interfaces_lan_wan "eth0" "eth1"
175 ucidef_add_switch "switch0" \
176 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
181 ucidef_set_interfaces_lan_wan "eth1" "eth0"
182 ucidef_add_switch "switch0" \
183 "1:lan" "2:lan" "5@eth1"
188 ucidef_set_interfaces_lan_wan "eth1" "eth0"
189 ucidef_add_switch "switch0" \
190 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
195 ucidef_set_interface_lan "eth1"
198 ucidef_set_interfaces_lan_wan "eth1" "eth0"
199 ucidef_add_switch "switch0" \
200 "0@eth1" "1:lan" "3:lan"
203 ucidef_set_interface_lan "eth0" "dhcp"
207 ucidef_add_switch "switch0" \
208 "0@eth0" "5:lan" "4:wan"
211 ucidef_set_interfaces_lan_wan "eth0" "eth1"
212 ucidef_add_switch "switch0" \
213 "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
224 ucidef_add_switch "switch0" \
225 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
237 ucidef_add_switch "switch0" \
238 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
241 ucidef_add_switch "switch0" \
242 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
246 ucidef_add_switch "switch1" \
247 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
265 ucidef_set_interfaces_lan_wan "eth1" "eth0"
266 ucidef_add_switch "switch0" \
267 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1"
273 ucidef_set_interfaces_lan_wan "eth0" "eth1"
274 ucidef_add_switch "switch0" \
275 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
278 ucidef_set_interface_lan "eth0"
279 ucidef_add_switch "switch0" \
280 "0@eth0" "2:lan" "3:lan" "4:lan"
281 ucidef_add_switch_attr "switch0" "enable" "false"
284 ucidef_set_interfaces_lan_wan "eth1" "eth0"
285 ucidef_add_switch "switch0" \
286 "0:lan" "1:lan" "3@eth1"
290 ucidef_add_switch "switch0" \
291 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
294 ucidef_add_switch "switch0" \
295 "0@eth0" "1:lan" "2:lan" "3:wan"
298 ucidef_set_interfaces_lan_wan "eth0" "eth1"
299 ucidef_add_switch "switch0" \
300 "0@eth0" "2:lan" "3:lan"
303 ucidef_set_interfaces_lan_wan "eth1" "eth0"
304 ucidef_add_switch "switch0" \
305 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "0@eth0" "1:wan"
308 ucidef_set_interfaces_lan_wan "eth1" "eth0"
309 ucidef_add_switch "switch0" \
310 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
313 ucidef_set_interfaces_lan_wan "eth0" "eth1"
314 ucidef_add_switch "switch0" \
315 "0@eth0" "1:lan" "5:wan" "6@eth1"
318 ucidef_add_switch "switch0" \
319 "0@eth0" "5:lan" "1:wan"
322 ucidef_set_interface_lan "wlan0"
325 ucidef_set_interfaces_lan_wan "eth1" "eth0"
326 ucidef_add_switch "switch0" \
327 "0@eth1" "1:lan" "2:lan"
330 ucidef_set_interfaces_lan_wan "eth1" "eth0"
331 ucidef_add_switch "switch0" \
332 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth1"
336 ucidef_set_interfaces_lan_wan "eth1" "eth0"
337 ucidef_add_switch "switch0" \
338 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
341 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
342 ucidef_add_switch "switch0" \
343 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
344 ucidef_add_switch "switch1" \
345 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
348 ucidef_set_interface_wan "eth0"
349 ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
353 ucidef_add_switch "switch0" \
354 "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
357 ucidef_add_switch "switch0" \
358 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
361 ucidef_add_switch "switch0" \
362 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
366 ucidef_set_interface_raw "eth" "eth0"
367 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
371 ucidef_add_switch "switch0" \
372 "0@eth0" "1:lan" "2:wan"
375 ucidef_add_switch "switch0" \
376 "0@eth0" "2:lan" "3:wan"
379 ucidef_set_interfaces_lan_wan "eth0" "eth1"
380 ucidef_add_switch "switch0" \
381 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
383 ucidef_add_switch_attr "switch0" "blinkrate" 2
384 ucidef_add_switch_port_attr "switch0" 1 led 6
385 ucidef_add_switch_port_attr "switch0" 2 led 9
386 ucidef_add_switch_port_attr "switch0" 5 led 2
389 ucidef_add_switch "switch0" \
390 "0@eth0" "3:lan" "2:wan"
393 ucidef_add_switch "switch0" \
394 "5:lan" "1:wan" "6@eth0"
397 ucidef_set_interfaces_lan_wan "eth0" "eth1"
398 ucidef_add_switch "switch0" \
399 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
402 ucidef_add_switch "switch0" \
403 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
406 ucidef_set_interfaces_lan_wan "eth0" "eth1"
407 ucidef_add_switch "switch0" \
408 "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "5:wan"
411 ucidef_set_interfaces_lan_wan "eth0" "eth1"
425 wan_mac=$(mtd_get_mac_ascii nvram "wan_mac")
431 lan_mac=$(mtd_get_mac_binary caldata 0)
432 wan_mac=$(mtd_get_mac_binary caldata 6)
435 wan_mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
438 wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
442 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
443 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
447 board=$(ar71xx_board_name)
448 ar71xx_setup_interfaces $board
449 ar71xx_setup_macs $board