wolfssl: fix TLSv1.3 RCE in uhttpd by using 5.5.1-stable (CVE-2022-39173)
[openwrt/openwrt.git] / target / linux / ar71xx / base-files / etc / board.d / 02_network
1 #!/bin/sh
2 #
3 # Copyright (C) 2011-2015 OpenWrt.org
4 #
5
6 . /lib/functions/system.sh
7 . /lib/functions/uci-defaults.sh
8
9 ar71xx_setup_interfaces()
10 {
11 local board="$1"
12
13 case "$board" in
14 airgatewaypro)
15 ucidef_add_switch "switch0" \
16 "0@eth0" "4:lan" "5:wan"
17 ;;
18 airrouter|\
19 ap121|\
20 ap121-mini|\
21 ap96|\
22 dir-600-a1|\
23 dir-615-c1|\
24 dir-615-e1|\
25 dir-615-e4|\
26 hiwifi-hc6361|\
27 ja76pf|\
28 mc-mac1200r|\
29 minibox-v1|\
30 mynet-n600|\
31 oolite|\
32 qihoo-c301|\
33 r602n|\
34 rb-750|\
35 rb-751|\
36 som9331|\
37 tew-632brp|\
38 tew-712br|\
39 tew-732br|\
40 tl-mr3220|\
41 tl-mr3220-v2|\
42 tl-mr3420|\
43 tl-wdr3320-v2|\
44 tl-wdr3500|\
45 tl-wr740n-v6|\
46 tl-wr741nd-v4|\
47 tl-wr840n-v2|\
48 tl-wr840n-v3|\
49 tl-wr841n-v11|\
50 tl-wr841n-v9|\
51 tl-wr842n-v3|\
52 whr-g301n|\
53 whr-hp-g300n|\
54 whr-hp-gn|\
55 wzr-hp-ag300h|\
56 zbt-we1526)
57 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
58 ucidef_add_switch "switch0" \
59 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
60 ;;
61 alfa-ap120c|\
62 all0305|\
63 antminer-s1|\
64 antminer-s3|\
65 antrouter-r1|\
66 ap121f|\
67 aw-nr580|\
68 bullet-m|\
69 c-55|\
70 cap4200ag|\
71 cf-e380ac-v1|\
72 cf-e380ac-v2|\
73 dr342|\
74 eap120|\
75 eap300v2|\
76 eap7660d|\
77 el-mini|\
78 fritz300e|\
79 gl-usb150|\
80 hiveap-121|\
81 loco-m-xw|\
82 mr12|\
83 mr16|\
84 mr1750|\
85 mr1750v2|\
86 mr18|\
87 mr600|\
88 mr600v2|\
89 mr900|\
90 mr900v2|\
91 mynet-rext|\
92 pqi-air-pen|\
93 rb-411|\
94 rb-411u|\
95 rb-911g-2hpnd|\
96 rb-911g-5hpacd|\
97 rb-911g-5hpnd|\
98 rb-912uag-2hpnd|\
99 rb-912uag-5hpnd|\
100 rb-921gs-5hpacd-r2|\
101 rb-lhg-5nd|\
102 rb-mapl-2nd|\
103 rb-sxt2n|\
104 rb-sxt5n|\
105 rb-wap-2nd|\
106 re450|\
107 rocket-m-xw|\
108 sc300m |\
109 tl-mr10u|\
110 tl-mr11u|\
111 tl-mr12u|\
112 tl-mr13u|\
113 tl-mr3020|\
114 tl-mr3040|\
115 tl-mr3040-v2|\
116 tl-wa701nd-v2|\
117 tl-wa7210n-v2|\
118 tl-wa750re|\
119 tl-wa801nd-v2|\
120 tl-wa830re-v2|\
121 tl-wa850re|\
122 tl-wa850re-v2|\
123 tl-wa855re-v1|\
124 tl-wa901nd|\
125 tl-wa901nd-v2|\
126 tl-wa901nd-v3|\
127 tl-wa901nd-v4|\
128 tl-wa901nd-v5|\
129 tl-wr703n|\
130 tl-wr802n-v1|\
131 tl-wr802n-v2|\
132 tl-wr902ac-v1|\
133 tube2h|\
134 unifi|\
135 unifiac-lite|\
136 wi2a-ac200i|\
137 wndap360|\
138 wp543)
139 ucidef_set_interface_lan "eth0"
140 ;;
141 a40|\
142 a60|\
143 alfa-ap96|\
144 alfa-nx|\
145 archer-c25-v1|\
146 dr344|\
147 gl-ar150|\
148 gl-ar300m|\
149 gl-domino|\
150 gl-inet|\
151 gl-mifi|\
152 jwap003|\
153 om2p-hsv4|\
154 om2pv4|\
155 pb42|\
156 pb44|\
157 rb-951ui-2hnd|\
158 rb-952ui-5ac2nd|\
159 routerstation|\
160 tl-wr710n|\
161 tl-wr720n-v3|\
162 tl-wr810n|\
163 tl-wr810n-v2|\
164 wpe72|\
165 wrtnode2q)
166 ucidef_set_interfaces_lan_wan "eth1" "eth0"
167 ;;
168 rb-750-r2|\
169 rb-750p-pbr2|\
170 rb-750up-r2|\
171 rb-951ui-2nd)
172 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
173 ucidef_add_switch "switch0" \
174 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
175 ;;
176 all0258n|\
177 all0315n|\
178 dlan-hotspot|\
179 dlan-pro-500-wp|\
180 ens202ext|\
181 ja76pf2|\
182 rocket-m-ti|\
183 ubnt-unifi-outdoor)
184 ucidef_set_interface_lan "eth0 eth1"
185 ;;
186 wzr-hp-g300nh2)
187 ucidef_add_switch "switch0" \
188 "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
189 ;;
190 ap132|\
191 ap136|\
192 ap152|\
193 rb-750gl|\
194 rb-751g|\
195 rb-951g-2hnd|\
196 rb-962uigs-5hact2hnt|\
197 wlr8100|\
198 wzr-hp-g450h)
199 ucidef_add_switch "switch0" \
200 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
201 ;;
202 ap135-020|\
203 ap136-020|\
204 bhr-4grv2|\
205 tew-823dru|\
206 tl-wr1043nd-v2|\
207 wzr-450hp2)
208 ucidef_set_interfaces_lan_wan "eth1.1" "eth0.2"
209 ucidef_add_switch "switch0" \
210 "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
211 ;;
212 ap136-010|\
213 ap147-010|\
214 nbg6616|\
215 nbg6716)
216 ucidef_set_interfaces_lan_wan "eth0.1" "eth1.2"
217 ucidef_add_switch "switch0" \
218 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
219 ;;
220 ap143|\
221 rb-433|\
222 rb-433u)
223 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
224 ucidef_add_switch "switch0" \
225 "1:lan" "2:lan" "5@eth1"
226 ;;
227 archer-c5|\
228 archer-c7|\
229 tl-wdr4900-v2)
230 ucidef_set_interfaces_lan_wan "eth1.1" "eth0.2"
231 ucidef_add_switch "switch0" \
232 "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
233 ;;
234 archer-c58-v1|\
235 archer-c59-v1|\
236 rb-450g)
237 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
238 ucidef_add_switch "switch0" \
239 "0@eth1" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
240 ;;
241 archer-c60-v1)
242 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
243 ucidef_add_switch "switch0" \
244 "0@eth1" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4"
245 ;;
246 arduino-yun|\
247 dir-505-a1|\
248 tl-wa801nd-v3)
249 ucidef_set_interface_lan "eth1"
250 ;;
251 bsb)
252 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
253 ucidef_add_switch "switch0" \
254 "0@eth1" "1:lan" "3:lan"
255 ;;
256 c-60)
257 ucidef_add_switch "switch0" \
258 "0@eth0" "3:wan" "4:lan"
259 ;;
260 cap324)
261 ucidef_set_interface_lan "eth0" "dhcp"
262 ;;
263 cpe210|\
264 cpe510|\
265 wbs210|\
266 wbs510)
267 ucidef_add_switch "switch0" \
268 "0@eth0" "5:lan" "4:wan"
269 ;;
270 cr3000)
271 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
272 ucidef_add_switch "switch0" \
273 "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
274 ;;
275 cr5000|\
276 dgl-5500-a1|\
277 dhp-1565-a1|\
278 dir-825-c1|\
279 dir-835-a1|\
280 esr900|\
281 mynet-n750|\
282 sr3200|\
283 tl-wr1043n-v5)
284 ucidef_add_switch "switch0" \
285 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
286 ;;
287 dap-2695-a1)
288 ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:wan" "6@eth1"
289 ;;
290 rb-941-2nd)
291 ucidef_add_switch "switch0" \
292 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:wan:1"
293 ;;
294 db120|\
295 rb-2011il|\
296 rb-2011l|\
297 rb-2011uas|\
298 rb-2011uas-2hnd|\
299 rb-2011uias|\
300 rb-2011uias-2hnd)
301 case "$board" in
302 rb-2011uas*|\
303 rb-2011uias|\
304 rb-2011uias-2hnd)
305 ucidef_add_switch "switch0" \
306 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
307 ;;
308 *)
309 ucidef_add_switch "switch0" \
310 "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
311 ;;
312 esac
313
314 ucidef_add_switch "switch1" \
315 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
316 ;;
317 dir-615-i1|\
318 omy-g1|\
319 r6100|\
320 smart-300|\
321 tl-wdr6500-v2|\
322 tl-wr940n-v4|\
323 tl-wr941nd-v6|\
324 wnr1000-v2|\
325 wnr2000-v4|\
326 wnr2200|\
327 wnr612-v2|\
328 wpn824n)
329 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
330 ucidef_add_switch "switch0" \
331 "0@eth1" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4"
332 ;;
333 tl-mr6400)
334 ucidef_set_interfaces_lan_wan "eth0.1 eth1" "usb0"
335 ucidef_add_switch "switch0" \
336 "0@eth0" "1:lan" "2:lan" "3:lan"
337 ;;
338 dir-825-b1|\
339 nbg460n_550n_550nh|\
340 tew-673gru|\
341 wzr-hp-g300nh)
342 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
343 ucidef_add_switch "switch0" \
344 "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
345 ;;
346 dlan-pro-1200-ac)
347 ucidef_set_interface_lan "eth0"
348 ucidef_add_switch "switch0" \
349 "0u@eth0" "2:lan" "3:lan" "4:lan"
350 ucidef_add_switch_attr "switch0" "enable" "false"
351 ;;
352 ebr-2310-c1)
353 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
354 ucidef_add_switch "switch0" \
355 "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4"
356 ;;
357 el-m150)
358 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
359 ucidef_add_switch "switch0" \
360 "0:lan" "1:lan" "3@eth1"
361 ;;
362 dir-869-a1|\
363 epg5000|\
364 esr1750|\
365 tl-wr1043nd-v4|\
366 wndr3700v4|\
367 wndr4300)
368 ucidef_add_switch "switch0" \
369 "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
370 ;;
371 ew-dorin)
372 ucidef_add_switch "switch0" \
373 "0@eth0" "1:lan" "2:lan" "3:wan"
374 ;;
375 ew-dorin-router)
376 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
377 ucidef_add_switch "switch0" \
378 "0@eth0" "2:lan" "3:lan"
379 ;;
380 dw33d|\
381 f9k1115v2)
382 ucidef_set_interfaces_lan_wan "eth1.1" "eth0.2"
383 ucidef_add_switch "switch0" \
384 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "0@eth0" "1:wan"
385 ;;
386 gl-ar300|\
387 wnr2000-v3)
388 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
389 ucidef_add_switch "switch0" \
390 "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
391 ;;
392 jwap230)
393 ucidef_set_interfaces_lan_wan "eth0.1" "eth1.2"
394 ucidef_add_switch "switch0" \
395 "0@eth0" "1:lan" "5:wan" "6@eth1"
396 ;;
397 nanostation-m-xw)
398 ucidef_add_switch "switch0" \
399 "0@eth0" "5:lan" "1:wan"
400 ;;
401 onion-omega)
402 ucidef_set_interface_lan "wlan0"
403 ;;
404 rb-435g)
405 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
406 ucidef_add_switch "switch0" \
407 "0@eth1" "1:lan" "2:lan"
408 ;;
409 rb-450)
410 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
411 ucidef_add_switch "switch0" \
412 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5@eth1"
413 ;;
414 routerstation-pro)
415 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
416 ucidef_add_switch "switch0" \
417 "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
418 ;;
419 rb-493g)
420 ucidef_set_interfaces_lan_wan "eth0.1 eth1.1" "eth1.2"
421 ucidef_add_switch "switch0" \
422 "0@eth0" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3"
423 ucidef_add_switch "switch1" \
424 "0@eth1" "1:lan:4" "2:lan:1" "3:lan:3" "4:lan:2" "5:wan"
425 ;;
426 rb-map-2nd)
427 ucidef_add_switch "switch0" \
428 "0@eth0" "1:wan" "2:lan"
429 ;;
430 tellstick-znet-lite)
431 ucidef_set_interface_wan "eth0"
432 ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
433 ;;
434 tl-mr3420-v2|\
435 tl-wr841n-v8|\
436 tl-wr842n-v2|\
437 tl-wr941nd-v5|\
438 tl-wr942n-v1)
439 ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
440 ucidef_add_switch "switch0" \
441 "0@eth1" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3"
442 ;;
443 archer-c7-v4|\
444 tl-wdr4300|\
445 tl-wr1041n-v2)
446 ucidef_add_switch "switch0" \
447 "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
448 ;;
449 tl-wpa8630)
450 ucidef_add_switch "switch0" \
451 "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "5:lan:4"
452 ;;
453 tl-wr1043nd)
454 ucidef_add_switch "switch0" \
455 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
456 ;;
457 tl-wr2543n)
458 ucidef_add_switch "switch0" \
459 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
460 ;;
461 tl-wr841n-v1|\
462 tl-wr941nd)
463 ucidef_set_interface_raw "eth" "eth0"
464 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
465 ;;
466 tl-wr741nd|\
467 tl-wr841n-v7)
468 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
469 ucidef_add_switch "switch0" \
470 "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4"
471 ;;
472 uap-pro|\
473 wpj342)
474 ucidef_add_switch "switch0" \
475 "0@eth0" "1:lan" "2:wan"
476 ;;
477 unifiac-pro|\
478 xd3200)
479 ucidef_add_switch "switch0" \
480 "0@eth0" "2:lan" "3:wan"
481 ;;
482 wndr3700|\
483 wndr3700v2|\
484 wndr3800|\
485 wndr3800ch)
486 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
487 ucidef_add_switch "switch0" \
488 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5@eth0"
489
490 ucidef_add_switch_attr "switch0" "blinkrate" 2
491 ucidef_add_switch_port_attr "switch0" 1 led 6
492 ucidef_add_switch_port_attr "switch0" 2 led 9
493 ucidef_add_switch_port_attr "switch0" 5 led 2
494 ;;
495 wpj344)
496 ucidef_add_switch "switch0" \
497 "0@eth0" "3:lan" "2:wan"
498 ;;
499 wpj558)
500 ucidef_add_switch "switch0" \
501 "5:lan" "1:wan" "6@eth0"
502 ;;
503 wpj563)
504 ucidef_add_switch "switch0" \
505 "0@eth0" "2:lan" "3:wan"
506 ;;
507 wrt160nl)
508 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
509 ucidef_add_switch "switch0" \
510 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
511 ;;
512 wzr-hp-g450h)
513 ucidef_add_switch "switch0" \
514 "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
515 ;;
516 z1)
517 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
518 ucidef_add_switch "switch0" \
519 "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "5:wan"
520 ;;
521 *)
522 ucidef_set_interfaces_lan_wan "eth0" "eth1"
523 ;;
524 esac
525 }
526
527 ar71xx_setup_macs()
528 {
529 local board="$1"
530 local lan_mac=""
531 local wan_mac=""
532
533 case $board in
534 dgl-5500-a1|\
535 dir-825-c1)
536 wan_mac=$(mtd_get_mac_ascii nvram "wan_mac")
537 ;;
538 dhp-1565-a1|\
539 dir-835-a1|\
540 wndr3700v4|\
541 wndr4300)
542 lan_mac=$(mtd_get_mac_binary caldata 0)
543 wan_mac=$(mtd_get_mac_binary caldata 6)
544 ;;
545 fritz300e)
546 lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
547 ;;
548 tl-wr1043n-v5|\
549 tl-wr1043nd-v4)
550 lan_mac=$(mtd_get_mac_binary product-info 8)
551 wan_mac=$(macaddr_add "$lan_mac" 1)
552 ;;
553 esr900)
554 wan_mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
555 ;;
556 dir-869-a1|\
557 mynet-n750)
558 wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
559 ;;
560 wpj344|\
561 wpj558)
562 wan_mac=$(mtd_get_mac_binary u-boot 0x2e018)
563 ;;
564 esac
565
566 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
567 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
568 }
569
570 board_config_update
571 board=$(board_name)
572 ar71xx_setup_interfaces $board
573 ar71xx_setup_macs $board
574 board_config_flush
575
576 exit 0