02_network 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. #!/bin/sh
  2. #
  3. # Copyright (C) 2011-2015 OpenWrt.org
  4. #
  5. . /lib/functions/uci-defaults.sh
  6. . /lib/functions/system.sh
  7. . /lib/functions/lantiq.sh
  8. board_config_update
  9. vpi=1
  10. vci=32
  11. annex="a"
  12. encaps="llc"
  13. payload="bridged"
  14. lan_mac=""
  15. wan_mac=""
  16. interface_wan=""
  17. board=$(board_name)
  18. case "$board" in
  19. ACMP252|GIGASX76X)
  20. ucidef_add_switch "switch0" \
  21. "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0"
  22. ;;
  23. ARV4510PW)
  24. lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
  25. wan_mac=$(macaddr_add "$lan_mac" 1)
  26. ucidef_add_switch "switch0" \
  27. "0:lan:4" "2:lan:2" "1:lan:3" "3:lan:1" "5t@eth0"
  28. ;;
  29. ARV4519PW|ARV7510PW22|ARV7518PW|ARV752DPW22|ARV8539PW22)
  30. ucidef_add_switch "switch0" \
  31. "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan"
  32. ;;
  33. ARV4520PW)
  34. ucidef_add_switch "switch0" \
  35. "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5t@eth0"
  36. ;;
  37. ARV7506PW11)
  38. wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 22)" 2)
  39. ucidef_add_switch "switch0" \
  40. "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0"
  41. ;;
  42. ARV7519PW)
  43. wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 22)" 1)
  44. ucidef_add_switch "switch0" \
  45. "0:lan" "1:lan" "2:lan" "3:lan" "4t@eth0"
  46. ;;
  47. ARV7519RW22)
  48. wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 22)" 1)
  49. ucidef_add_switch "switch0" \
  50. "0:lan:5" "2:lan:3" "3:lan:4" "4:lan:1" "5:lan:2" "6t@eth0"
  51. ;;
  52. BTHOMEHUBV2B)
  53. lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
  54. wan_mac=$(macaddr_add "$lan_mac" 1)
  55. ucidef_add_switch "switch0" \
  56. "1:lan" "2:lan" "3:lan" "4:lan" "5t@eth0"
  57. ;;
  58. BTHOMEHUBV3A)
  59. lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
  60. wan_mac=$(macaddr_add "$lan_mac" 1)
  61. ucidef_set_interface_lan 'eth0'
  62. ;;
  63. BTHOMEHUBV5A)
  64. lan_mac=$(mtd_get_mac_binary_ubi caldata 4364)
  65. wan_mac=$(macaddr_add "$lan_mac" 1)
  66. ucidef_add_switch "switch0" \
  67. "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0"
  68. ;;
  69. DGN3500*)
  70. ucidef_add_switch "switch0" \
  71. "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5t@eth0"
  72. ;;
  73. EASY80920NAND|EASY80920NOR)
  74. lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
  75. wan_mac=$(macaddr_add "$lan_mac" 1)
  76. ucidef_add_switch "switch0" \
  77. "0:lan:4" "1:lan:3" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0"
  78. ;;
  79. FRITZ3370)
  80. wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 2439)" 1)
  81. ucidef_set_interface_lan 'eth0'
  82. ;;
  83. FRITZ7320)
  84. wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 2705)" 1)
  85. ucidef_set_interface_lan 'eth0'
  86. ;;
  87. FRITZ7360SL)
  88. wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 2705)" 1)
  89. ucidef_add_switch "switch0" \
  90. "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0"
  91. ;;
  92. H201L)
  93. ucidef_add_switch "switch0" \
  94. "0:lan" "1:lan" "2:lan" "3:lan" "4t@eth0"
  95. ;;
  96. P2601HNFX)
  97. ucidef_add_switch "switch0" \
  98. "0:lan" "1:lan" "2:lan" "3:lan" "5t@eth0"
  99. ;;
  100. P2812HNUF*)
  101. lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr)
  102. wan_mac=$(macaddr_add "$lan_mac" 1)
  103. ucidef_add_switch "switch0" \
  104. "0:lan" "1:lan" "2:lan" "4:lan" "5:wan" "6t@eth0"
  105. ;;
  106. TDW8970|TDW8980)
  107. wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 61696)" 1)
  108. ucidef_add_switch "switch0" \
  109. "0:lan:2" "2:lan:3" "4:lan:4" "5:lan:1" "6t@eth0"
  110. ;;
  111. VG3503J)
  112. lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr)
  113. wan_mac=$(macaddr_add "$lan_mac" 1)
  114. ucidef_add_switch "switch0" \
  115. "2:lan:1" "4:lan:2" "6t@eth0"
  116. ;;
  117. VR200v)
  118. wan_mac=$(macaddr_add "$(mtd_get_mac_binary romfile 61696)" 1)
  119. ucidef_add_switch "switch0" \
  120. "0:lan" "2:lan" "4:lan" "5:lan" "6t@eth0"
  121. ;;
  122. VGV7510KW22*)
  123. wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 22)" 2)
  124. ucidef_add_switch "switch0" \
  125. "2:lan:2" "3:lan:1" "4:lan:4" "5:lan:3" "0:wan:5" "6t@eth0"
  126. ;;
  127. VGV7519*)
  128. wan_mac=$(mtd_get_mac_binary board_config 22)
  129. ucidef_add_switch "switch0" \
  130. "0:lan:4" "1:lan:3" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0"
  131. ;;
  132. WBMR)
  133. ucidef_add_switch "switch0" \
  134. "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan"
  135. ;;
  136. WBMR300)
  137. lan_mac=$(mtd_get_mac_ascii ubootconfig ethaddr)
  138. wan_mac="$lan_mac"
  139. ucidef_add_switch "switch0" \
  140. "5:lan:2" "2:lan:3" "3:lan:4" "4:wan:1" "6t@eth0"
  141. ;;
  142. *)
  143. ucidef_set_interface_lan 'eth0'
  144. ;;
  145. esac
  146. if [ -n "$(ls /lib/modules/`uname -r`/ltq_atm*)" ]; then
  147. ucidef_add_atm_bridge "$vpi" "$vci" "$encaps" "$payload"
  148. fi
  149. if lantiq_is_vdsl_system; then
  150. interface_wan="ptm0"
  151. ucidef_add_vdsl_modem "$annex" "av" "ptm"
  152. else
  153. interface_wan="nas0"
  154. ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin"
  155. fi
  156. ucidef_set_interface_wan "$interface_wan" "pppoe"
  157. [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
  158. [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac"
  159. board_config_flush
  160. exit 0