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"
352 ucidef_set_interfaces_lan_wan "eth1" "eth0"
353 ucidef_add_switch "switch0" \
354 "0@eth1" "1:lan" "2:lan"
357 ucidef_set_interfaces_lan_wan "eth1" "eth0"
358 ucidef_add_switch "switch0" \
359 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5@eth1"
362 ucidef_set_interfaces_lan_wan "eth1" "eth0"
363 ucidef_add_switch "switch0" \
364 "0@eth1" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
367 ucidef_set_interfaces_lan_wan "eth1" "eth0"
368 ucidef_add_switch "switch0" \
369 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
372 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
373 ucidef_add_switch "switch0" \
374 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
375 ucidef_add_switch "switch1" \
376 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
379 ucidef_set_interface_wan "eth0"
380 ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
384 ucidef_add_switch "switch0" \
385 "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
388 ucidef_add_switch "switch0" \
389 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "5:lan:4"
392 ucidef_add_switch "switch0" \
393 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
396 ucidef_add_switch "switch0" \
397 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
401 ucidef_set_interface_raw "eth" "eth0"
402 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "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"
411 ucidef_set_interfaces_lan_wan "eth1" "eth0"
412 ucidef_add_switch "switch0" \
413 "0@eth1" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3"
417 ucidef_add_switch "switch0" \
418 "0@eth0" "1:lan" "2:wan"
422 ucidef_add_switch "switch0" \
423 "0@eth0" "2:lan" "3:wan"
429 ucidef_set_interfaces_lan_wan "eth0" "eth1"
430 ucidef_add_switch "switch0" \
431 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5@eth0"
433 ucidef_add_switch_attr "switch0" "blinkrate" 2
434 ucidef_add_switch_port_attr "switch0" 1 led 6
435 ucidef_add_switch_port_attr "switch0" 2 led 9
436 ucidef_add_switch_port_attr "switch0" 5 led 2
439 ucidef_add_switch "switch0" \
440 "0@eth0" "3:lan" "2:wan"
443 ucidef_add_switch "switch0" \
444 "5:lan" "1:wan" "6@eth0"
447 ucidef_set_interfaces_lan_wan "eth0" "eth1"
448 ucidef_add_switch "switch0" \
449 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
452 ucidef_add_switch "switch0" \
453 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
456 ucidef_set_interfaces_lan_wan "eth0" "eth1"
457 ucidef_add_switch "switch0" \
458 "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "5:wan"
461 ucidef_set_interfaces_lan_wan "eth0" "eth1"
475 wan_mac=$(mtd_get_mac_ascii nvram "wan_mac")
481 lan_mac=$(mtd_get_mac_binary caldata 0)
482 wan_mac=$(mtd_get_mac_binary caldata 6)
485 lan_mac=$(mtd_get_mac_binary product-info 8)
486 wan_mac=$(macaddr_add "$lan_mac" 1)
489 wan_mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
493 wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
497 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
498 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
502 board=$(ar71xx_board_name)
503 ar71xx_setup_interfaces $board
504 ar71xx_setup_macs $board