02_network 14 KB

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