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"
58 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
59 ucidef_add_switch "switch0" \
60 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
128 ucidef_set_interface_lan "eth0"
155 ucidef_set_interfaces_lan_wan "eth1" "eth0"
165 ucidef_set_interface_lan "eth0 eth1"
168 ucidef_add_switch "switch0" \
169 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
177 rb-962uigs-5hact2hnt|\
180 ucidef_add_switch "switch0" \
181 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
189 ucidef_set_interfaces_lan_wan "eth1.1" "eth0.2"
190 ucidef_add_switch "switch0" \
191 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
197 ucidef_set_interfaces_lan_wan "eth0.1" "eth1.2"
198 ucidef_add_switch "switch0" \
199 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
204 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
205 ucidef_add_switch "switch0" \
206 "1:lan" "2:lan" "5@eth1"
211 ucidef_set_interfaces_lan_wan "eth1.1" "eth0.2"
212 ucidef_add_switch "switch0" \
213 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
217 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
218 ucidef_add_switch "switch0" \
219 "0@eth1" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
222 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
223 ucidef_add_switch "switch0" \
224 "0@eth1" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4"
229 ucidef_set_interface_lan "eth1"
232 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
233 ucidef_add_switch "switch0" \
234 "0@eth1" "1:lan" "3:lan"
237 ucidef_add_switch "switch0" \
238 "0@eth0" "3:wan" "4:lan"
241 ucidef_set_interface_lan "eth0" "dhcp"
247 ucidef_add_switch "switch0" \
248 "0@eth0" "5:lan" "4:wan"
251 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
252 ucidef_add_switch "switch0" \
253 "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
264 ucidef_add_switch "switch0" \
265 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
268 ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:wan" "6@eth1"
271 ucidef_add_switch "switch0" \
272 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:wan:1"
284 ucidef_add_switch "switch0" \
285 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
288 ucidef_add_switch "switch0" \
289 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
293 ucidef_add_switch "switch1" \
294 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
311 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
312 ucidef_add_switch "switch0" \
313 "0@eth1" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4"
319 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
320 ucidef_add_switch "switch0" \
321 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
324 ucidef_set_interface_lan "eth0"
325 ucidef_add_switch "switch0" \
326 "0u@eth0" "2:lan" "3:lan" "4:lan"
327 ucidef_add_switch_attr "switch0" "enable" "false"
330 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
331 ucidef_add_switch "switch0" \
332 "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4"
335 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
336 ucidef_add_switch "switch0" \
337 "0:lan" "1:lan" "3@eth1"
344 ucidef_add_switch "switch0" \
345 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
348 ucidef_add_switch "switch0" \
349 "0@eth0" "1:lan" "2:lan" "3:wan"
352 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
353 ucidef_add_switch "switch0" \
354 "0@eth0" "2:lan" "3:lan"
358 ucidef_set_interfaces_lan_wan "eth1.1" "eth0.2"
359 ucidef_add_switch "switch0" \
360 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "0@eth0" "1:wan"
364 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
365 ucidef_add_switch "switch0" \
366 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
369 ucidef_set_interfaces_lan_wan "eth0.1" "eth1.2"
370 ucidef_add_switch "switch0" \
371 "0@eth0" "1:lan" "5:wan" "6@eth1"
374 ucidef_add_switch "switch0" \
375 "0@eth0" "5:lan" "1:wan"
378 ucidef_set_interface_lan "wlan0"
381 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
382 ucidef_add_switch "switch0" \
383 "0@eth1" "1:lan" "2:lan"
386 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
387 ucidef_add_switch "switch0" \
388 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5@eth1"
391 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
392 ucidef_add_switch "switch0" \
393 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
396 ucidef_set_interfaces_lan_wan "eth0.1 eth1.1" "eth1.2"
397 ucidef_add_switch "switch0" \
398 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
399 ucidef_add_switch "switch1" \
400 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
403 ucidef_set_interface_wan "eth0"
404 ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
408 ucidef_add_switch "switch0" \
409 "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
412 ucidef_add_switch "switch0" \
413 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "5:lan:4"
416 ucidef_add_switch "switch0" \
417 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
420 ucidef_add_switch "switch0" \
421 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
425 ucidef_set_interface_raw "eth" "eth0"
426 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
429 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
430 ucidef_add_switch "switch0" \
431 "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4"
434 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
435 ucidef_add_switch "switch0" \
436 "0@eth1" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3"
440 ucidef_add_switch "switch0" \
441 "0@eth0" "1:lan" "2:wan"
445 ucidef_add_switch "switch0" \
446 "0@eth0" "2:lan" "3:wan"
452 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
453 ucidef_add_switch "switch0" \
454 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5@eth0"
456 ucidef_add_switch_attr "switch0" "blinkrate" 2
457 ucidef_add_switch_port_attr "switch0" 1 led 6
458 ucidef_add_switch_port_attr "switch0" 2 led 9
459 ucidef_add_switch_port_attr "switch0" 5 led 2
462 ucidef_add_switch "switch0" \
463 "0@eth0" "3:lan" "2:wan"
466 ucidef_add_switch "switch0" \
467 "5:lan" "1:wan" "6@eth0"
470 ucidef_add_switch "switch0" \
471 "0@eth0" "2:lan" "3:wan"
474 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
475 ucidef_add_switch "switch0" \
476 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
479 ucidef_add_switch "switch0" \
480 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
483 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
484 ucidef_add_switch "switch0" \
485 "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "5:wan"
488 ucidef_set_interfaces_lan_wan "eth0" "eth1"
502 wan_mac=$(mtd_get_mac_ascii nvram "wan_mac")
508 lan_mac=$(mtd_get_mac_binary caldata 0)
509 wan_mac=$(mtd_get_mac_binary caldata 6)
512 wan_mac=$(mtd_get_mac_binary config 0x1017c)
515 wan_mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
519 wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
523 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
524 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
528 board=$(ar71xx_board_name)
529 ar71xx_setup_interfaces $board
530 ar71xx_setup_macs $board