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"
119 ucidef_set_interface_lan "eth0"
138 ucidef_set_interfaces_lan_wan "eth1" "eth0"
148 ucidef_set_interface_lan "eth0 eth1"
151 ucidef_add_switch "switch0" \
152 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
162 ucidef_add_switch "switch0" \
163 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
171 ucidef_set_interfaces_lan_wan "eth1" "eth0"
172 ucidef_add_switch "switch0" \
173 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
179 ucidef_set_interfaces_lan_wan "eth0" "eth1"
180 ucidef_add_switch "switch0" \
181 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
186 ucidef_set_interfaces_lan_wan "eth1" "eth0"
187 ucidef_add_switch "switch0" \
188 "1:lan" "2:lan" "5@eth1"
193 ucidef_set_interfaces_lan_wan "eth1" "eth0"
194 ucidef_add_switch "switch0" \
195 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
200 ucidef_set_interface_lan "eth1"
203 ucidef_set_interfaces_lan_wan "eth1" "eth0"
204 ucidef_add_switch "switch0" \
205 "0@eth1" "1:lan" "3:lan"
208 ucidef_add_switch "switch0" \
209 "0@eth0" "3:wan" "4:lan"
212 ucidef_set_interface_lan "eth0" "dhcp"
218 ucidef_add_switch "switch0" \
219 "0@eth0" "5:lan" "4:wan"
222 ucidef_set_interfaces_lan_wan "eth0" "eth1"
223 ucidef_add_switch "switch0" \
224 "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
236 ucidef_add_switch "switch0" \
237 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
240 ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:wan" "6@eth1"
252 ucidef_add_switch "switch0" \
253 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
256 ucidef_add_switch "switch0" \
257 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
261 ucidef_add_switch "switch1" \
262 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
280 ucidef_set_interfaces_lan_wan "eth1" "eth0"
281 ucidef_add_switch "switch0" \
282 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1"
288 ucidef_set_interfaces_lan_wan "eth0" "eth1"
289 ucidef_add_switch "switch0" \
290 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
293 ucidef_set_interface_lan "eth0"
294 ucidef_add_switch "switch0" \
295 "0@eth0" "2:lan" "3:lan" "4:lan"
296 ucidef_add_switch_attr "switch0" "enable" "false"
299 ucidef_set_interfaces_lan_wan "eth1" "eth0"
300 ucidef_add_switch "switch0" \
301 "0:lan" "1:lan" "3@eth1"
307 ucidef_add_switch "switch0" \
308 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
311 ucidef_add_switch "switch0" \
312 "0@eth0" "1:lan" "2:lan" "3:wan"
315 ucidef_set_interfaces_lan_wan "eth0" "eth1"
316 ucidef_add_switch "switch0" \
317 "0@eth0" "2:lan" "3:lan"
321 ucidef_set_interfaces_lan_wan "eth1" "eth0"
322 ucidef_add_switch "switch0" \
323 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "0@eth0" "1:wan"
326 ucidef_set_interfaces_lan_wan "eth1" "eth0"
327 ucidef_add_switch "switch0" \
328 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
331 ucidef_set_interfaces_lan_wan "eth0" "eth1"
332 ucidef_add_switch "switch0" \
333 "0@eth0" "1:lan" "5:wan" "6@eth1"
336 ucidef_add_switch "switch0" \
337 "0@eth0" "5:lan" "1:wan"
340 ucidef_set_interface_lan "wlan0"
343 ucidef_set_interfaces_lan_wan "eth1" "eth0"
344 ucidef_add_switch "switch0" \
345 "0@eth1" "1:lan" "2:lan"
348 ucidef_set_interfaces_lan_wan "eth1" "eth0"
349 ucidef_add_switch "switch0" \
350 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5@eth1"
353 ucidef_set_interfaces_lan_wan "eth1" "eth0"
354 ucidef_add_switch "switch0" \
355 "0@eth1" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
358 ucidef_set_interfaces_lan_wan "eth1" "eth0"
359 ucidef_add_switch "switch0" \
360 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
363 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
364 ucidef_add_switch "switch0" \
365 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
366 ucidef_add_switch "switch1" \
367 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
370 ucidef_set_interface_wan "eth0"
371 ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
375 ucidef_add_switch "switch0" \
376 "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
379 ucidef_add_switch "switch0" \
380 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "5:lan:4"
383 ucidef_add_switch "switch0" \
384 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
387 ucidef_add_switch "switch0" \
388 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
392 ucidef_set_interface_raw "eth" "eth0"
393 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
396 ucidef_set_interfaces_lan_wan "eth1" "eth0"
397 ucidef_add_switch "switch0" \
398 "0@eth1" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3"
402 ucidef_add_switch "switch0" \
403 "0@eth0" "1:lan" "2:wan"
407 ucidef_add_switch "switch0" \
408 "0@eth0" "2:lan" "3:wan"
411 ucidef_set_interfaces_lan_wan "eth0" "eth1"
412 ucidef_add_switch "switch0" \
413 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
415 ucidef_add_switch_attr "switch0" "blinkrate" 2
416 ucidef_add_switch_port_attr "switch0" 1 led 6
417 ucidef_add_switch_port_attr "switch0" 2 led 9
418 ucidef_add_switch_port_attr "switch0" 5 led 2
421 ucidef_add_switch "switch0" \
422 "0@eth0" "3:lan" "2:wan"
425 ucidef_add_switch "switch0" \
426 "5:lan" "1:wan" "6@eth0"
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" "4@eth0"
434 ucidef_add_switch "switch0" \
435 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
438 ucidef_set_interfaces_lan_wan "eth0" "eth1"
439 ucidef_add_switch "switch0" \
440 "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "5:wan"
443 ucidef_set_interfaces_lan_wan "eth0" "eth1"
457 wan_mac=$(mtd_get_mac_ascii nvram "wan_mac")
463 lan_mac=$(mtd_get_mac_binary caldata 0)
464 wan_mac=$(mtd_get_mac_binary caldata 6)
467 wan_mac=$(mtd_get_mac_binary config 0x1017c)
470 wan_mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
474 wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
478 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
479 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
483 board=$(ar71xx_board_name)
484 ar71xx_setup_interfaces $board
485 ar71xx_setup_macs $board