02_network 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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=$(lantiq_board_name)
  18. case "$board" in
  19. # adm6996
  20. ARV4510PW)
  21. lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
  22. wan_mac=$(macaddr_add "$lan_mac" 1)
  23. ucidef_add_switch "switch0" \
  24. "3:lan:1" "2:lan:2" "1:lan:3" "0:lan:4" "5t@eth0"
  25. ;;
  26. ARV4520PW)
  27. ucidef_add_switch "switch0" \
  28. "3:lan:1" "2:lan:2" "1:lan:3" "0:lan:4" "5t@eth0"
  29. ;;
  30. ACMP252|GIGASX76X)
  31. ucidef_add_switch "switch0" \
  32. "4:lan:1" "3:lan:2" "2:lan:3" "1:lan:4" "5t@eth0"
  33. ;;
  34. # ar8316
  35. ARV4519PW|ARV7510PW22|ARV7518PW|ARV752DPW22|ARV8539PW22)
  36. ucidef_add_switch "switch0" \
  37. "0t@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4"
  38. ;;
  39. # rtl8306g
  40. ARV7519PW)
  41. lan_mac=$(mtd_get_mac_binary board_config 22)
  42. wan_mac=$(macaddr_add "$lan_mac" 1)
  43. ucidef_add_switch "switch0" \
  44. "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "4t@eth0"
  45. ;;
  46. WBMR)
  47. ucidef_add_switch "switch0" \
  48. "0t@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4"
  49. ;;
  50. VG3503J)
  51. ucidef_set_interface_lan 'eth0'
  52. ;;
  53. ARV4518PWR01*)
  54. ucidef_set_interface_lan 'eth0'
  55. ;;
  56. DGN3500*)
  57. ucidef_add_switch "switch0" \
  58. "3:lan:1" "2:lan:2" "1:lan:3" "0:lan:4" "5t@eth0"
  59. ;;
  60. FRITZ7360SL)
  61. ucidef_add_switch "switch0" \
  62. "4:lan:1" "2:lan:2" "0:lan:3" "1:lan:4" "6t@eth0"
  63. ;;
  64. GR7000)
  65. ucidef_set_interface_wan "eth0"
  66. ;;
  67. H201L)
  68. ucidef_add_switch "switch0" \
  69. "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "4t@eth0"
  70. ;;
  71. #rtl8306g
  72. P2601HNFX)
  73. ucidef_add_switch "switch0" \
  74. "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "5t@eth0"
  75. ;;
  76. P2812HNUF*)
  77. lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr)
  78. wan_mac=$(macaddr_add "$lan_mac" 1)
  79. ucidef_add_switch "switch0" \
  80. "0:lan:1" "1:lan:2" "2:lan:3" "4:lan:4" "5:lan:5" "6t@eth0"
  81. ;;
  82. TDW8970|TDW8980)
  83. lan_mac=$(mtd_get_mac_binary boardconfig 61696)
  84. wan_mac=$(macaddr_add "$lan_mac" 1)
  85. ucidef_add_switch "switch0" \
  86. "0:lan:1" "2:lan:2" "4:lan:3" "5:lan:4" "6t@eth0"
  87. ;;
  88. VR200v)
  89. lan_mac=$(mtd_get_mac_binary romfile 61696)
  90. wan_mac=$(macaddr_add "$lan_mac" 1)
  91. ucidef_add_switch "switch0" \
  92. "0:lan:1" "2:lan:2" "4:lan:3" "5:lan:4" "6t@eth0"
  93. ;;
  94. ARV7519RW22)
  95. lan_mac=$(mtd_get_mac_binary boardconfig 22)
  96. wan_mac=$(macaddr_add "$lan_mac" 1)
  97. ucidef_add_switch "switch0" \
  98. "0:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "5:lan:5" "6t@eth0"
  99. ;;
  100. BTHOMEHUBV2B|BTHOMEHUBV3A)
  101. lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
  102. wan_mac=$(macaddr_add "$lan_mac" 1)
  103. ucidef_set_interface_lan 'eth0'
  104. ;;
  105. BTHOMEHUBV5A)
  106. lan_mac=$(mtd_get_mac_binary caldata 4364)
  107. wan_mac=$(macaddr_add "$lan_mac" 1)
  108. ucidef_add_switch "switch0" \
  109. "0:lan:1" "1:lan:2" "2:lan:3" "4:lan:4" "6t@eth0"
  110. ;;
  111. VGV7519)
  112. lan_mac=$(mtd_get_mac_binary board_config 22)
  113. wan_mac=$(macaddr_add "$lan_mac" 1)
  114. ucidef_add_switch "switch0" \
  115. "4:lan:1" "2:lan:2" "1:lan:3" "0:lan:4" "6t@eth0"
  116. ;;
  117. VGV7510KW22)
  118. lan_mac=$(mtd_get_mac_binary board_config 22)
  119. wan_mac=$(macaddr_add "$lan_mac" 1)
  120. ucidef_add_switch "switch0" \
  121. "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "6t@eth0"
  122. ;;
  123. WBMR300)
  124. lan_mac=$(mtd_get_mac_ascii ubootconfig ethaddr)
  125. wan_mac="$lan_mac"
  126. ucidef_add_switch "switch0" \
  127. "2:lan:1" "3:lan:2" "5:lan:3" "4:wan:1" "6t@eth0"
  128. ;;
  129. *)
  130. ucidef_set_interface_lan 'eth0'
  131. ;;
  132. esac
  133. if [ -n "$(ls /lib/modules/`uname -r`/ltq_atm*)" ]; then
  134. ucidef_add_atm_bridge "$vpi" "$vci" "$encaps" "$payload"
  135. fi
  136. if grep -qE "system type.*: (VR9|xRX200)" /proc/cpuinfo; then
  137. interface_wan="ptm0"
  138. ucidef_add_vdsl_modem "$annex" "av" "ptm"
  139. else
  140. interface_wan="nas0"
  141. ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin"
  142. fi
  143. ucidef_set_interface_wan "$interface_wan" "pppoe"
  144. [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan "$lan_mac"
  145. [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan "$wan_mac"
  146. board_config_flush
  147. exit 0