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"
114 ucidef_set_interface_lan "eth0"
134 ucidef_set_interfaces_lan_wan "eth1" "eth0"
144 ucidef_set_interface_lan "eth0 eth1"
149 ucidef_add_switch "switch0" \
150 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
160 ucidef_add_switch "switch0" \
161 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
168 ucidef_set_interfaces_lan_wan "eth1" "eth0"
169 ucidef_add_switch "switch0" \
170 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
176 ucidef_set_interfaces_lan_wan "eth0" "eth1"
177 ucidef_add_switch "switch0" \
178 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
183 ucidef_set_interfaces_lan_wan "eth1" "eth0"
184 ucidef_add_switch "switch0" \
185 "1:lan" "2:lan" "5@eth1"
190 ucidef_set_interfaces_lan_wan "eth1" "eth0"
191 ucidef_add_switch "switch0" \
192 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
197 ucidef_set_interface_lan "eth1"
200 ucidef_set_interfaces_lan_wan "eth1" "eth0"
201 ucidef_add_switch "switch0" \
202 "0@eth1" "1:lan" "3:lan"
205 ucidef_add_switch "switch0" \
206 "0@eth0" "3:wan" "4:lan"
209 ucidef_set_interface_lan "eth0" "dhcp"
213 ucidef_add_switch "switch0" \
214 "0@eth0" "5:lan" "4:wan"
217 ucidef_set_interfaces_lan_wan "eth0" "eth1"
218 ucidef_add_switch "switch0" \
219 "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
230 ucidef_add_switch "switch0" \
231 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
243 ucidef_add_switch "switch0" \
244 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
247 ucidef_add_switch "switch0" \
248 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
252 ucidef_add_switch "switch1" \
253 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
271 ucidef_set_interfaces_lan_wan "eth1" "eth0"
272 ucidef_add_switch "switch0" \
273 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1"
279 ucidef_set_interfaces_lan_wan "eth0" "eth1"
280 ucidef_add_switch "switch0" \
281 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
284 ucidef_set_interface_lan "eth0"
285 ucidef_add_switch "switch0" \
286 "0@eth0" "2:lan" "3:lan" "4:lan"
287 ucidef_add_switch_attr "switch0" "enable" "false"
290 ucidef_set_interfaces_lan_wan "eth1" "eth0"
291 ucidef_add_switch "switch0" \
292 "0:lan" "1:lan" "3@eth1"
297 ucidef_add_switch "switch0" \
298 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
301 ucidef_add_switch "switch0" \
302 "0@eth0" "1:lan" "2:lan" "3:wan"
305 ucidef_set_interfaces_lan_wan "eth0" "eth1"
306 ucidef_add_switch "switch0" \
307 "0@eth0" "2:lan" "3:lan"
311 ucidef_set_interfaces_lan_wan "eth1" "eth0"
312 ucidef_add_switch "switch0" \
313 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "0@eth0" "1:wan"
316 ucidef_set_interfaces_lan_wan "eth1" "eth0"
317 ucidef_add_switch "switch0" \
318 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
321 ucidef_set_interfaces_lan_wan "eth0" "eth1"
322 ucidef_add_switch "switch0" \
323 "0@eth0" "1:lan" "5:wan" "6@eth1"
326 ucidef_add_switch "switch0" \
327 "0@eth0" "5:lan" "1:wan"
330 ucidef_set_interface_lan "wlan0"
333 ucidef_set_interfaces_lan_wan "eth1" "eth0"
334 ucidef_add_switch "switch0" \
335 "0@eth1" "1:lan" "2:lan"
338 ucidef_set_interfaces_lan_wan "eth1" "eth0"
339 ucidef_add_switch "switch0" \
340 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth1"
344 ucidef_set_interfaces_lan_wan "eth1" "eth0"
345 ucidef_add_switch "switch0" \
346 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
349 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
350 ucidef_add_switch "switch0" \
351 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
352 ucidef_add_switch "switch1" \
353 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
356 ucidef_set_interface_wan "eth0"
357 ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
361 ucidef_add_switch "switch0" \
362 "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
365 ucidef_add_switch "switch0" \
366 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
369 ucidef_add_switch "switch0" \
370 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
374 ucidef_set_interface_raw "eth" "eth0"
375 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
379 ucidef_add_switch "switch0" \
380 "0@eth0" "1:lan" "2:wan"
383 ucidef_add_switch "switch0" \
384 "0@eth0" "2:lan" "3:wan"
387 ucidef_set_interfaces_lan_wan "eth0" "eth1"
388 ucidef_add_switch "switch0" \
389 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
391 ucidef_add_switch_attr "switch0" "blinkrate" 2
392 ucidef_add_switch_port_attr "switch0" 1 led 6
393 ucidef_add_switch_port_attr "switch0" 2 led 9
394 ucidef_add_switch_port_attr "switch0" 5 led 2
397 ucidef_add_switch "switch0" \
398 "0@eth0" "3:lan" "2:wan"
401 ucidef_add_switch "switch0" \
402 "5:lan" "1:wan" "6@eth0"
405 ucidef_set_interfaces_lan_wan "eth0" "eth1"
406 ucidef_add_switch "switch0" \
407 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
410 ucidef_add_switch "switch0" \
411 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
414 ucidef_set_interfaces_lan_wan "eth0" "eth1"
415 ucidef_add_switch "switch0" \
416 "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "5:wan"
419 ucidef_set_interfaces_lan_wan "eth0" "eth1"
433 wan_mac=$(mtd_get_mac_ascii nvram "wan_mac")
439 lan_mac=$(mtd_get_mac_binary caldata 0)
440 wan_mac=$(mtd_get_mac_binary caldata 6)
443 wan_mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
447 wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
451 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
452 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
456 board=$(ar71xx_board_name)
457 ar71xx_setup_interfaces $board
458 ar71xx_setup_macs $board