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"
54 ucidef_set_interfaces_lan_wan "eth0" "eth1"
55 ucidef_add_switch "switch0" \
56 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
120 ucidef_set_interface_lan "eth0"
144 ucidef_set_interfaces_lan_wan "eth1" "eth0"
153 ucidef_set_interface_lan "eth0 eth1"
156 ucidef_add_switch "switch0" \
157 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
167 ucidef_add_switch "switch0" \
168 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
176 ucidef_set_interfaces_lan_wan "eth1" "eth0"
177 ucidef_add_switch "switch0" \
178 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
184 ucidef_set_interfaces_lan_wan "eth0" "eth1"
185 ucidef_add_switch "switch0" \
186 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
191 ucidef_set_interfaces_lan_wan "eth1" "eth0"
192 ucidef_add_switch "switch0" \
193 "1:lan" "2:lan" "5@eth1"
198 ucidef_set_interfaces_lan_wan "eth1" "eth0"
199 ucidef_add_switch "switch0" \
200 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
205 ucidef_set_interface_lan "eth1"
208 ucidef_set_interfaces_lan_wan "eth1" "eth0"
209 ucidef_add_switch "switch0" \
210 "0@eth1" "1:lan" "3:lan"
213 ucidef_add_switch "switch0" \
214 "0@eth0" "3:wan" "4:lan"
217 ucidef_set_interface_lan "eth0" "dhcp"
223 ucidef_add_switch "switch0" \
224 "0@eth0" "5:lan" "4:wan"
227 ucidef_set_interfaces_lan_wan "eth0" "eth1"
228 ucidef_add_switch "switch0" \
229 "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
241 ucidef_add_switch "switch0" \
242 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
245 ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:wan" "6@eth1"
248 ucidef_add_switch "switch0" \
249 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:wan:1"
261 ucidef_add_switch "switch0" \
262 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
265 ucidef_add_switch "switch0" \
266 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
270 ucidef_add_switch "switch1" \
271 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
288 ucidef_set_interfaces_lan_wan "eth1" "eth0"
289 ucidef_add_switch "switch0" \
290 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1"
296 ucidef_set_interfaces_lan_wan "eth0" "eth1"
297 ucidef_add_switch "switch0" \
298 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
301 ucidef_set_interface_lan "eth0"
302 ucidef_add_switch "switch0" \
303 "0@eth0" "2:lan" "3:lan" "4:lan"
304 ucidef_add_switch_attr "switch0" "enable" "false"
307 ucidef_set_interfaces_lan_wan "eth1" "eth0"
308 ucidef_add_switch "switch0" \
309 "0:lan" "1:lan" "3@eth1"
315 ucidef_add_switch "switch0" \
316 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
319 ucidef_add_switch "switch0" \
320 "0@eth0" "1:lan" "2:lan" "3:wan"
323 ucidef_set_interfaces_lan_wan "eth0" "eth1"
324 ucidef_add_switch "switch0" \
325 "0@eth0" "2:lan" "3:lan"
329 ucidef_set_interfaces_lan_wan "eth1" "eth0"
330 ucidef_add_switch "switch0" \
331 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "0@eth0" "1:wan"
335 ucidef_set_interfaces_lan_wan "eth1" "eth0"
336 ucidef_add_switch "switch0" \
337 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
340 ucidef_set_interfaces_lan_wan "eth0" "eth1"
341 ucidef_add_switch "switch0" \
342 "0@eth0" "1:lan" "5:wan" "6@eth1"
345 ucidef_add_switch "switch0" \
346 "0@eth0" "5:lan" "1:wan"
349 ucidef_set_interface_lan "wlan0"
353 ucidef_set_interfaces_lan_wan "eth1" "eth0"
354 ucidef_add_switch "switch0" \
355 "0@eth1" "1:lan" "2:lan"
358 ucidef_set_interfaces_lan_wan "eth1" "eth0"
359 ucidef_add_switch "switch0" \
360 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5@eth1"
363 ucidef_set_interfaces_lan_wan "eth1" "eth0"
364 ucidef_add_switch "switch0" \
365 "0@eth1" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
368 ucidef_set_interfaces_lan_wan "eth1" "eth0"
369 ucidef_add_switch "switch0" \
370 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
373 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
374 ucidef_add_switch "switch0" \
375 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
376 ucidef_add_switch "switch1" \
377 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
380 ucidef_set_interface_wan "eth0"
381 ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
385 ucidef_add_switch "switch0" \
386 "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
389 ucidef_add_switch "switch0" \
390 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "5:lan:4"
393 ucidef_add_switch "switch0" \
394 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
397 ucidef_add_switch "switch0" \
398 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
402 ucidef_set_interface_raw "eth" "eth0"
403 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
407 ucidef_set_interfaces_lan_wan "eth0" "eth1"
408 ucidef_add_switch "switch0" \
409 "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4"
412 ucidef_set_interfaces_lan_wan "eth1" "eth0"
413 ucidef_add_switch "switch0" \
414 "0@eth1" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3"
418 ucidef_add_switch "switch0" \
419 "0@eth0" "1:lan" "2:wan"
423 ucidef_add_switch "switch0" \
424 "0@eth0" "2:lan" "3:wan"
430 ucidef_set_interfaces_lan_wan "eth0" "eth1"
431 ucidef_add_switch "switch0" \
432 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5@eth0"
434 ucidef_add_switch_attr "switch0" "blinkrate" 2
435 ucidef_add_switch_port_attr "switch0" 1 led 6
436 ucidef_add_switch_port_attr "switch0" 2 led 9
437 ucidef_add_switch_port_attr "switch0" 5 led 2
440 ucidef_add_switch "switch0" \
441 "0@eth0" "3:lan" "2:wan"
444 ucidef_add_switch "switch0" \
445 "5:lan" "1:wan" "6@eth0"
448 ucidef_set_interfaces_lan_wan "eth0" "eth1"
449 ucidef_add_switch "switch0" \
450 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
453 ucidef_add_switch "switch0" \
454 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
457 ucidef_set_interfaces_lan_wan "eth0" "eth1"
458 ucidef_add_switch "switch0" \
459 "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "5:wan"
462 ucidef_set_interfaces_lan_wan "eth0" "eth1"
476 wan_mac=$(mtd_get_mac_ascii nvram "wan_mac")
482 lan_mac=$(mtd_get_mac_binary caldata 0)
483 wan_mac=$(mtd_get_mac_binary caldata 6)
486 lan_mac=$(mtd_get_mac_binary product-info 8)
487 wan_mac=$(macaddr_add "$lan_mac" 1)
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