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"
112 ucidef_set_interface_lan "eth0"
132 ucidef_set_interfaces_lan_wan "eth1" "eth0"
142 ucidef_set_interface_lan "eth0 eth1"
147 ucidef_add_switch "switch0" \
148 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
158 ucidef_add_switch "switch0" \
159 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
166 ucidef_set_interfaces_lan_wan "eth1" "eth0"
167 ucidef_add_switch "switch0" \
168 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
174 ucidef_set_interfaces_lan_wan "eth0" "eth1"
175 ucidef_add_switch "switch0" \
176 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
181 ucidef_set_interfaces_lan_wan "eth1" "eth0"
182 ucidef_add_switch "switch0" \
183 "1:lan" "2:lan" "5@eth1"
188 ucidef_set_interfaces_lan_wan "eth1" "eth0"
189 ucidef_add_switch "switch0" \
190 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
195 ucidef_set_interface_lan "eth1"
198 ucidef_set_interfaces_lan_wan "eth1" "eth0"
199 ucidef_add_switch "switch0" \
200 "0@eth1" "1:lan" "3:lan"
203 ucidef_add_switch "switch0" \
204 "0@eth0" "3:wan" "4:lan"
207 ucidef_set_interface_lan "eth0" "dhcp"
211 ucidef_add_switch "switch0" \
212 "0@eth0" "5:lan" "4:wan"
215 ucidef_set_interfaces_lan_wan "eth0" "eth1"
216 ucidef_add_switch "switch0" \
217 "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
228 ucidef_add_switch "switch0" \
229 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
241 ucidef_add_switch "switch0" \
242 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
245 ucidef_add_switch "switch0" \
246 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
250 ucidef_add_switch "switch1" \
251 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
269 ucidef_set_interfaces_lan_wan "eth1" "eth0"
270 ucidef_add_switch "switch0" \
271 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1"
277 ucidef_set_interfaces_lan_wan "eth0" "eth1"
278 ucidef_add_switch "switch0" \
279 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
282 ucidef_set_interface_lan "eth0"
283 ucidef_add_switch "switch0" \
284 "0@eth0" "2:lan" "3:lan" "4:lan"
285 ucidef_add_switch_attr "switch0" "enable" "false"
288 ucidef_set_interfaces_lan_wan "eth1" "eth0"
289 ucidef_add_switch "switch0" \
290 "0:lan" "1:lan" "3@eth1"
295 ucidef_add_switch "switch0" \
296 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
299 ucidef_add_switch "switch0" \
300 "0@eth0" "1:lan" "2:lan" "3:wan"
303 ucidef_set_interfaces_lan_wan "eth0" "eth1"
304 ucidef_add_switch "switch0" \
305 "0@eth0" "2:lan" "3:lan"
308 ucidef_set_interfaces_lan_wan "eth1" "eth0"
309 ucidef_add_switch "switch0" \
310 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "0@eth0" "1:wan"
313 ucidef_set_interfaces_lan_wan "eth1" "eth0"
314 ucidef_add_switch "switch0" \
315 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
318 ucidef_set_interfaces_lan_wan "eth0" "eth1"
319 ucidef_add_switch "switch0" \
320 "0@eth0" "1:lan" "5:wan" "6@eth1"
323 ucidef_add_switch "switch0" \
324 "0@eth0" "5:lan" "1:wan"
327 ucidef_set_interface_lan "wlan0"
330 ucidef_set_interfaces_lan_wan "eth1" "eth0"
331 ucidef_add_switch "switch0" \
332 "0@eth1" "1:lan" "2:lan"
335 ucidef_set_interfaces_lan_wan "eth1" "eth0"
336 ucidef_add_switch "switch0" \
337 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth1"
341 ucidef_set_interfaces_lan_wan "eth1" "eth0"
342 ucidef_add_switch "switch0" \
343 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
346 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
347 ucidef_add_switch "switch0" \
348 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
349 ucidef_add_switch "switch1" \
350 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
353 ucidef_set_interface_wan "eth0"
354 ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
358 ucidef_add_switch "switch0" \
359 "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
362 ucidef_add_switch "switch0" \
363 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
366 ucidef_add_switch "switch0" \
367 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
371 ucidef_set_interface_raw "eth" "eth0"
372 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
376 ucidef_add_switch "switch0" \
377 "0@eth0" "1:lan" "2:wan"
380 ucidef_add_switch "switch0" \
381 "0@eth0" "2:lan" "3:wan"
384 ucidef_set_interfaces_lan_wan "eth0" "eth1"
385 ucidef_add_switch "switch0" \
386 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
388 ucidef_add_switch_attr "switch0" "blinkrate" 2
389 ucidef_add_switch_port_attr "switch0" 1 led 6
390 ucidef_add_switch_port_attr "switch0" 2 led 9
391 ucidef_add_switch_port_attr "switch0" 5 led 2
394 ucidef_add_switch "switch0" \
395 "0@eth0" "3:lan" "2:wan"
398 ucidef_add_switch "switch0" \
399 "5:lan" "1:wan" "6@eth0"
402 ucidef_set_interfaces_lan_wan "eth0" "eth1"
403 ucidef_add_switch "switch0" \
404 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
407 ucidef_add_switch "switch0" \
408 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
411 ucidef_set_interfaces_lan_wan "eth0" "eth1"
412 ucidef_add_switch "switch0" \
413 "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "5:wan"
416 ucidef_set_interfaces_lan_wan "eth0" "eth1"
430 wan_mac=$(mtd_get_mac_ascii nvram "wan_mac")
436 lan_mac=$(mtd_get_mac_binary caldata 0)
437 wan_mac=$(mtd_get_mac_binary caldata 6)
440 wan_mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
444 wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
448 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
449 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
453 board=$(ar71xx_board_name)
454 ar71xx_setup_interfaces $board
455 ar71xx_setup_macs $board