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"
113 ucidef_set_interface_lan "eth0"
133 ucidef_set_interfaces_lan_wan "eth1" "eth0"
143 ucidef_set_interface_lan "eth0 eth1"
148 ucidef_add_switch "switch0" \
149 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
159 ucidef_add_switch "switch0" \
160 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
167 ucidef_set_interfaces_lan_wan "eth1" "eth0"
168 ucidef_add_switch "switch0" \
169 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
175 ucidef_set_interfaces_lan_wan "eth0" "eth1"
176 ucidef_add_switch "switch0" \
177 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
182 ucidef_set_interfaces_lan_wan "eth1" "eth0"
183 ucidef_add_switch "switch0" \
184 "1:lan" "2:lan" "5@eth1"
189 ucidef_set_interfaces_lan_wan "eth1" "eth0"
190 ucidef_add_switch "switch0" \
191 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
196 ucidef_set_interface_lan "eth1"
199 ucidef_set_interfaces_lan_wan "eth1" "eth0"
200 ucidef_add_switch "switch0" \
201 "0@eth1" "1:lan" "3:lan"
204 ucidef_add_switch "switch0" \
205 "0@eth0" "3:wan" "4:lan"
208 ucidef_set_interface_lan "eth0" "dhcp"
212 ucidef_add_switch "switch0" \
213 "0@eth0" "5:lan" "4:wan"
216 ucidef_set_interfaces_lan_wan "eth0" "eth1"
217 ucidef_add_switch "switch0" \
218 "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
229 ucidef_add_switch "switch0" \
230 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
242 ucidef_add_switch "switch0" \
243 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
246 ucidef_add_switch "switch0" \
247 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
251 ucidef_add_switch "switch1" \
252 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
270 ucidef_set_interfaces_lan_wan "eth1" "eth0"
271 ucidef_add_switch "switch0" \
272 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1"
278 ucidef_set_interfaces_lan_wan "eth0" "eth1"
279 ucidef_add_switch "switch0" \
280 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
283 ucidef_set_interface_lan "eth0"
284 ucidef_add_switch "switch0" \
285 "0@eth0" "2:lan" "3:lan" "4:lan"
286 ucidef_add_switch_attr "switch0" "enable" "false"
289 ucidef_set_interfaces_lan_wan "eth1" "eth0"
290 ucidef_add_switch "switch0" \
291 "0:lan" "1:lan" "3@eth1"
296 ucidef_add_switch "switch0" \
297 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
300 ucidef_add_switch "switch0" \
301 "0@eth0" "1:lan" "2:lan" "3:wan"
304 ucidef_set_interfaces_lan_wan "eth0" "eth1"
305 ucidef_add_switch "switch0" \
306 "0@eth0" "2:lan" "3:lan"
309 ucidef_set_interfaces_lan_wan "eth1" "eth0"
310 ucidef_add_switch "switch0" \
311 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "0@eth0" "1:wan"
314 ucidef_set_interfaces_lan_wan "eth1" "eth0"
315 ucidef_add_switch "switch0" \
316 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
319 ucidef_set_interfaces_lan_wan "eth0" "eth1"
320 ucidef_add_switch "switch0" \
321 "0@eth0" "1:lan" "5:wan" "6@eth1"
324 ucidef_add_switch "switch0" \
325 "0@eth0" "5:lan" "1:wan"
328 ucidef_set_interface_lan "wlan0"
331 ucidef_set_interfaces_lan_wan "eth1" "eth0"
332 ucidef_add_switch "switch0" \
333 "0@eth1" "1:lan" "2:lan"
336 ucidef_set_interfaces_lan_wan "eth1" "eth0"
337 ucidef_add_switch "switch0" \
338 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth1"
342 ucidef_set_interfaces_lan_wan "eth1" "eth0"
343 ucidef_add_switch "switch0" \
344 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
347 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
348 ucidef_add_switch "switch0" \
349 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
350 ucidef_add_switch "switch1" \
351 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
354 ucidef_set_interface_wan "eth0"
355 ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
359 ucidef_add_switch "switch0" \
360 "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
363 ucidef_add_switch "switch0" \
364 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
367 ucidef_add_switch "switch0" \
368 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
372 ucidef_set_interface_raw "eth" "eth0"
373 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
377 ucidef_add_switch "switch0" \
378 "0@eth0" "1:lan" "2:wan"
381 ucidef_add_switch "switch0" \
382 "0@eth0" "2:lan" "3:wan"
385 ucidef_set_interfaces_lan_wan "eth0" "eth1"
386 ucidef_add_switch "switch0" \
387 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
389 ucidef_add_switch_attr "switch0" "blinkrate" 2
390 ucidef_add_switch_port_attr "switch0" 1 led 6
391 ucidef_add_switch_port_attr "switch0" 2 led 9
392 ucidef_add_switch_port_attr "switch0" 5 led 2
395 ucidef_add_switch "switch0" \
396 "0@eth0" "3:lan" "2:wan"
399 ucidef_add_switch "switch0" \
400 "5:lan" "1:wan" "6@eth0"
403 ucidef_set_interfaces_lan_wan "eth0" "eth1"
404 ucidef_add_switch "switch0" \
405 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
408 ucidef_add_switch "switch0" \
409 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
412 ucidef_set_interfaces_lan_wan "eth0" "eth1"
413 ucidef_add_switch "switch0" \
414 "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "5:wan"
417 ucidef_set_interfaces_lan_wan "eth0" "eth1"
431 wan_mac=$(mtd_get_mac_ascii nvram "wan_mac")
437 lan_mac=$(mtd_get_mac_binary caldata 0)
438 wan_mac=$(mtd_get_mac_binary caldata 6)
441 wan_mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
445 wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
449 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
450 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
454 board=$(ar71xx_board_name)
455 ar71xx_setup_interfaces $board
456 ar71xx_setup_macs $board