3 # Copyright (C) 2011-2015 OpenWrt.org
6 .
/lib
/functions
/system.sh
7 .
/lib
/functions
/uci-defaults.sh
10 ar71xx_setup_interfaces
()
21 ucidef_set_interface_lan
"eth0 eth1"
27 ucidef_add_switch
"switch0" \
28 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
33 ucidef_add_switch
"switch0" \
34 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
38 ucidef_add_switch
"switch0" \
39 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
44 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
45 ucidef_add_switch
"switch0" \
46 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
54 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
55 ucidef_add_switch
"switch0" \
56 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
62 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
63 ucidef_add_switch
"switch0" \
64 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
68 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
69 ucidef_add_switch
"switch0" \
70 "0@eth1" "1:lan" "3:lan" # XXX: confirm cpu port!
75 ucidef_add_switch
"switch0" \
76 "0@eth0" "5:lan" "4:wan"
80 ucidef_add_switch
"switch0" \
81 "0@eth0" "4:lan" "5:wan"
91 rb-2011uas
* | rb-2011uias | rb-2011uias-2hnd
)
92 ucidef_add_switch
"switch0" \
93 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
96 ucidef_add_switch
"switch0" \
97 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
101 ucidef_add_switch
"switch1" \
102 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
107 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
108 ucidef_add_switch
"switch0" \
109 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
113 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
114 ucidef_add_switch
"switch0" \
115 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" \
116 "0@eth0" "1:wan" # XXX: confirm cpu ports!
120 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
121 ucidef_add_switch
"switch0" \
122 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
127 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
128 ucidef_add_switch
"switch0" \
129 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" \
136 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
137 ucidef_add_switch
"switch0" \
138 "1:lan" "2:lan" "5@eth1"
142 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
143 ucidef_add_switch
"switch0" \
144 "0@eth1" "1:lan" "2:lan" # XXX: confirm!
148 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
149 ucidef_add_switch
"switch0" \
150 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth1"
155 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
156 ucidef_add_switch
"switch0" \
157 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
165 ucidef_add_switch
"switch0" \
166 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
170 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
174 ucidef_set_interfaces_lan_wan
"eth0 eth1.1" "eth1.2"
175 ucidef_add_switch
"switch0" \
176 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
177 ucidef_add_switch
"switch1" \
178 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
184 ucidef_add_switch
"switch0" \
185 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
189 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
190 ucidef_add_switch
"switch0" \
191 "0:lan" "1:lan" "3@eth1" # XXX: confirm!
195 ucidef_set_interface_wan
"eth0"
196 ucidef_set_interface_raw
"wlan" "wlan0" "dhcp"
201 ucidef_add_switch
"switch0" \
202 "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
206 ucidef_add_switch
"switch0" \
207 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
211 ucidef_add_switch
"switch0" \
212 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
217 ucidef_set_interface_raw
"eth" "eth0"
218 ucidef_set_interfaces_lan_wan
"lan1 lan2 lan3 lan4" "wan"
237 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
238 ucidef_add_switch
"switch0" \
239 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1" # XXX: confirm!
243 ucidef_add_switch
"switch0" \
244 "0@eth0" "1:lan" "2:wan"
248 ucidef_add_switch
"switch0" \
249 "0@eth0" "5:lan" "1:wan"
253 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
254 ucidef_add_switch
"switch0" \
255 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
259 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
260 ucidef_add_switch
"switch0" \
261 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
265 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
266 ucidef_add_switch
"switch0" \
267 "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
272 ucidef_add_switch
"switch0" \
273 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
277 ucidef_add_switch
"switch0" \
278 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
282 ucidef_set_interface_lan
"wlan0"
289 ucidef_add_switch
"switch0" \
290 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
294 ucidef_add_switch
"switch0" \
295 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
300 ucidef_set_interface_lan
"eth0 eth1"
304 ucidef_set_interface_lan
"eth0"
305 ucidef_add_switch
"switch0" \
306 "0@eth0" "2:lan" "3:lan" "4:lan"
307 ucidef_add_switch_attr
"switch0" "enable" "false"
362 ucidef_set_interface_lan
"eth0"
366 ucidef_set_interface_lan
"eth0" "dhcp"
372 ucidef_set_interface_lan
"eth1"
392 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
396 ucidef_set_interfaces_lan_wan
"eth1" "eth0"
397 ucidef_add_switch
"switch0" \
398 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
402 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
403 ucidef_add_switch
"switch0" \
404 "0@eth0" "1:lan" "5:wan" "6@eth1"
408 ucidef_add_switch
"switch0" \
409 "0@eth0" "1:lan" "2:wan"
413 ucidef_add_switch
"switch0" \
414 "0@eth0" "3:lan" "2:wan"
418 ucidef_add_switch
"switch0" \
419 "0@eth0" "2:lan" "3:wan"
424 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
428 ucidef_add_switch
"switch0" \
429 "5:lan" "1:wan" "6@eth0"
469 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
470 ucidef_add_switch
"switch0" \
471 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
475 ucidef_add_switch
"switch0" \
476 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
480 ucidef_add_switch
"switch0" \
481 "0@eth0" "1:lan" "2:lan" "3:wan"
485 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
486 ucidef_add_switch
"switch0" "0@eth0" "2:lan" "3:lan"
490 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
491 ucidef_add_switch
"switch0" \
492 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
494 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
495 ucidef_add_switch_attr
"switch0" "blinkrate" 2
497 # Port 1 controls the GREEN configuration of LEDs for
498 # the switch and the section does not correspond to a real
501 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
502 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
503 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
504 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
505 # 14: Link (master); 15: separate register
506 ucidef_add_switch_port_attr
"switch0" 1 led
6
508 # Port 2 controls the ORANGE configuration of LEDs for
509 # the switch and the section does not correspond to a real
512 # See the key above for switch port 1 for the meaning of the
513 # 'led' setting below.
514 ucidef_add_switch_port_attr
"switch0" 2 led
9
516 # Port 5 controls the configuration of the WAN LED and the
517 # section does not correspond to a real switch port.
519 # To toggle the use of green or orange LEDs for the WAN port,
520 # see the LED setting for wndr3700:green:wan in /etc/config/system.
522 # See the key above for switch port 1 for the meaning of the
523 # 'led' setting below.
524 ucidef_add_switch_port_attr
"switch0" 5 led
2
528 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
529 ucidef_add_switch
"switch0" \
530 "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "5:wan"
534 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
548 wan_mac
=$
(mtd_get_mac_ascii nvram
"wan_mac")
554 lan_mac
=$
(mtd_get_mac_binary caldata
0)
555 wan_mac
=$
(mtd_get_mac_binary caldata
6)
558 wan_mac
=$
(mtd_get_mac_ascii u-boot-env
"wanaddr")
561 wan_mac
=$
(mtd_get_mac_ascii devdata
"wanmac")
565 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr
"lan" $lan_mac
566 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr
"wan" $wan_mac
570 board
=$
(ar71xx_board_name
)
571 ar71xx_setup_interfaces
$board
572 ar71xx_setup_macs
$board