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"
55 ucidef_set_interfaces_lan_wan "eth0" "eth1"
56 ucidef_add_switch "switch0" \
57 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
120 ucidef_set_interface_lan "eth0"
128 ucidef_set_interface_lan "eth0"
146 ucidef_set_interfaces_lan_wan "eth1" "eth0"
156 ucidef_set_interface_lan "eth0 eth1"
159 ucidef_add_switch "switch0" \
160 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
170 ucidef_add_switch "switch0" \
171 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
179 ucidef_set_interfaces_lan_wan "eth1" "eth0"
180 ucidef_add_switch "switch0" \
181 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
187 ucidef_set_interfaces_lan_wan "eth0" "eth1"
188 ucidef_add_switch "switch0" \
189 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
194 ucidef_set_interfaces_lan_wan "eth1" "eth0"
195 ucidef_add_switch "switch0" \
196 "1:lan" "2:lan" "5@eth1"
201 ucidef_set_interfaces_lan_wan "eth1" "eth0"
202 ucidef_add_switch "switch0" \
203 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
208 ucidef_set_interface_lan "eth1"
211 ucidef_set_interfaces_lan_wan "eth1" "eth0"
212 ucidef_add_switch "switch0" \
213 "0@eth1" "1:lan" "3:lan"
216 ucidef_add_switch "switch0" \
217 "0@eth0" "3:wan" "4:lan"
220 ucidef_set_interface_lan "eth0" "dhcp"
226 ucidef_add_switch "switch0" \
227 "0@eth0" "5:lan" "4:wan"
230 ucidef_set_interfaces_lan_wan "eth0" "eth1"
231 ucidef_add_switch "switch0" \
232 "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
244 ucidef_add_switch "switch0" \
245 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
248 ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:wan" "6@eth1"
251 ucidef_add_switch "switch0" \
252 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:wan:1"
264 ucidef_add_switch "switch0" \
265 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
268 ucidef_add_switch "switch0" \
269 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
273 ucidef_add_switch "switch1" \
274 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
291 ucidef_set_interfaces_lan_wan "eth1" "eth0"
292 ucidef_add_switch "switch0" \
293 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1"
299 ucidef_set_interfaces_lan_wan "eth0" "eth1"
300 ucidef_add_switch "switch0" \
301 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
304 ucidef_set_interface_lan "eth0"
305 ucidef_add_switch "switch0" \
306 "0@eth0" "2:lan" "3:lan" "4:lan"
307 ucidef_add_switch_attr "switch0" "enable" "false"
310 ucidef_set_interfaces_lan_wan "eth1" "eth0"
311 ucidef_add_switch "switch0" \
312 "0:lan" "1:lan" "3@eth1"
318 ucidef_add_switch "switch0" \
319 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
322 ucidef_add_switch "switch0" \
323 "0@eth0" "1:lan" "2:lan" "3:wan"
326 ucidef_set_interfaces_lan_wan "eth0" "eth1"
327 ucidef_add_switch "switch0" \
328 "0@eth0" "2:lan" "3:lan"
332 ucidef_set_interfaces_lan_wan "eth1" "eth0"
333 ucidef_add_switch "switch0" \
334 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "0@eth0" "1:wan"
338 ucidef_set_interfaces_lan_wan "eth1" "eth0"
339 ucidef_add_switch "switch0" \
340 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
343 ucidef_set_interfaces_lan_wan "eth0" "eth1"
344 ucidef_add_switch "switch0" \
345 "0@eth0" "1:lan" "5:wan" "6@eth1"
348 ucidef_add_switch "switch0" \
349 "0@eth0" "5:lan" "1:wan"
352 ucidef_set_interface_lan "wlan0"
355 ucidef_set_interfaces_lan_wan "eth1" "eth0"
356 ucidef_add_switch "switch0" \
357 "0@eth1" "1:lan" "2:lan"
360 ucidef_set_interfaces_lan_wan "eth1" "eth0"
361 ucidef_add_switch "switch0" \
362 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5@eth1"
365 ucidef_set_interfaces_lan_wan "eth1" "eth0"
366 ucidef_add_switch "switch0" \
367 "0@eth1" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
370 ucidef_set_interfaces_lan_wan "eth1" "eth0"
371 ucidef_add_switch "switch0" \
372 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
375 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
376 ucidef_add_switch "switch0" \
377 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
378 ucidef_add_switch "switch1" \
379 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
382 ucidef_set_interface_wan "eth0"
383 ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
387 ucidef_add_switch "switch0" \
388 "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
391 ucidef_add_switch "switch0" \
392 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "5:lan:4"
395 ucidef_add_switch "switch0" \
396 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
399 ucidef_add_switch "switch0" \
400 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
404 ucidef_set_interface_raw "eth" "eth0"
405 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
408 ucidef_set_interfaces_lan_wan "eth0" "eth1"
409 ucidef_add_switch "switch0" \
410 "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4"
413 ucidef_set_interfaces_lan_wan "eth1" "eth0"
414 ucidef_add_switch "switch0" \
415 "0@eth1" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3"
419 ucidef_add_switch "switch0" \
420 "0@eth0" "1:lan" "2:wan"
424 ucidef_add_switch "switch0" \
425 "0@eth0" "2:lan" "3:wan"
431 ucidef_set_interfaces_lan_wan "eth0" "eth1"
432 ucidef_add_switch "switch0" \
433 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5@eth0"
435 ucidef_add_switch_attr "switch0" "blinkrate" 2
436 ucidef_add_switch_port_attr "switch0" 1 led 6
437 ucidef_add_switch_port_attr "switch0" 2 led 9
438 ucidef_add_switch_port_attr "switch0" 5 led 2
441 ucidef_add_switch "switch0" \
442 "0@eth0" "3:lan" "2:wan"
445 ucidef_add_switch "switch0" \
446 "5:lan" "1:wan" "6@eth0"
449 ucidef_set_interfaces_lan_wan "eth0" "eth1"
450 ucidef_add_switch "switch0" \
451 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
454 ucidef_add_switch "switch0" \
455 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
458 ucidef_set_interfaces_lan_wan "eth0" "eth1"
459 ucidef_add_switch "switch0" \
460 "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "5:wan"
463 ucidef_set_interfaces_lan_wan "eth0" "eth1"
477 wan_mac=$(mtd_get_mac_ascii nvram "wan_mac")
483 lan_mac=$(mtd_get_mac_binary caldata 0)
484 wan_mac=$(mtd_get_mac_binary caldata 6)
487 wan_mac=$(mtd_get_mac_binary config 0x1017c)
490 wan_mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
494 wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
498 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
499 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
503 board=$(ar71xx_board_name)
504 ar71xx_setup_interfaces $board
505 ar71xx_setup_macs $board