Guest User

Untitled

a guest
Jul 25th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.62 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # Copyright (C) 2011-2012 OpenWrt.org
  4. #
  5.  
  6. #[ -e /etc/config/network ] && exit 0
  7.  
  8. set_atm_wan() {
  9. local vpi=$1
  10. local vci=$2
  11. local encaps=$3
  12. local payload=$4
  13. uci batch <<EOF
  14. set network.atm='atm-bridge'
  15. set network.atm.unit='0'
  16. set network.atm.vpi='$vpi'
  17. set network.atm.vci='$vci'
  18. set network.atm.encaps='$encaps'
  19. set network.atm.payload='$payload'
  20. set network.wan='interface'
  21. set network.wan.ifname='nas0'
  22. set network.wan.proto='pppoe'
  23. set network.wan.username='foo'
  24. set network.wan.password='bar'
  25. EOF
  26. }
  27.  
  28. set_wan() {
  29. local vpi=$1
  30. local vci=$2
  31. local encaps=$3
  32. local proto=$4
  33. uci batch <<EOF
  34. set network.wan='interface'
  35. set network.wan.ifname='nas0'
  36. set network.wan.atmdev='0'
  37. set network.wan.proto='$proto'
  38. set network.wan.vpi='$vpi'
  39. set network.wan.vci='$vci'
  40. set network.wan.encaps='$encaps'
  41. set network.wan.username='foo'
  42. set network.wan.password='bar'
  43. EOF
  44. }
  45.  
  46. set_adsl() {
  47. local fwannex=$1
  48. local annex=$2
  49. uci batch <<EOF
  50. set network.adsl='adsl-device'
  51. set network.adsl.fwannex='$fwannex'
  52. set network.adsl.annex='$annex'
  53. EOF
  54. }
  55.  
  56. . /lib/functions/uci-defaults.sh
  57. . /lib/lantiq.sh
  58.  
  59. touch /etc/config/network
  60.  
  61. ucidef_set_interface_loopback
  62. ucidef_set_interface_lan 'eth0'
  63.  
  64. vpi=1
  65. vci=32
  66. encaps="llc"
  67. payload="bridged"
  68. fwannex=$(lantiq_dsl_fwannex)
  69. board=$(lantiq_board_name)
  70. dsl=$(lantiq_soc_has_adsl)
  71.  
  72. case "$board" in
  73. # annex B with adm6996
  74. ARV4520PW|GIGASX76X)
  75. ucidef_set_interface_lan "eth0.1"
  76. ucidef_add_switch "eth0" "1" "1"
  77. ucidef_add_switch_vlan "eth0" "1" "1 2 3 4 5t"
  78. set_adsl "b" "b2p"
  79. [ -z "$dsl" ] || set_atm_wan "$vpi" "$vci" "$encaps" "$payload"
  80. ;;
  81.  
  82. # annex A with ar8316
  83. ARV4519PW|ARV7518PW)
  84. ucidef_set_interface_lan "eth0.1"
  85. ucidef_add_switch "eth0" "1" "1"
  86. ucidef_add_switch_vlan "eth0" "1" "0t 2 3 4 5"
  87. set_adsl "a" "a2p"
  88. [ -z "$dsl" ] || set_atm_wan "$vpi" "$vci" "$encaps" "$payload"
  89. ;;
  90.  
  91. # annex A with adm6996, uk adsl, no atm bridge
  92. BTHOMEHUBV2B|BT3HHA)
  93. ucidef_set_interface_lan "eth0.1"
  94. ucidef_add_switch "eth0" "1" "1"
  95. ucidef_add_switch_vlan "eth0" "1" "1 2 3 4 5t"
  96. set_adsl "$fwannex" "${fwannex}2p"
  97. set_wan 0 38 "vc" "pppoa"
  98. ;;
  99.  
  100. ARV7525PW|ARV4525PW|*)
  101. set_adsl "$fwannex" "${fwannex}2p"
  102. [ -z "$dsl" ] || set_atm_wan "$vpi" "$vci" "$encaps" "$payload"
  103. ;;
  104.  
  105. esac
  106.  
  107.  
  108. uci commit network
  109.  
  110. exit 0
  111.  
  112. #!/bin/sh
  113. #
  114. # Copyright (C) 2011-2012 OpenWrt.org
  115. #
  116.  
  117. #[ -e /etc/config/network ] && exit 0
  118.  
  119. set_atm_wan() {
  120. local vpi=$1
  121. local vci=$2
  122. local encaps=$3
  123. local payload=$4
  124. uci batch <<EOF
  125. set network.atm='atm-bridge'
  126. set network.atm.unit='0'
  127. set network.atm.vpi='$vpi'
  128. set network.atm.vci='$vci'
  129. set network.atm.encaps='$encaps'
  130. set network.atm.payload='$payload'
  131. set network.wan='interface'
  132. set network.wan.ifname='nas0'
  133. set network.wan.proto='pppoe'
  134. set network.wan.username='foo'
  135. set network.wan.password='bar'
  136. EOF
  137. }
  138.  
  139. set_wan() {
  140. local vpi=$1
  141. local vci=$2
  142. local encaps=$3
  143. local proto=$4
  144. uci batch <<EOF
  145. set network.wan='interface'
  146. set network.wan.ifname='nas0'
  147. set network.wan.atmdev='0'
  148. set network.wan.proto='$proto'
  149. set network.wan.vpi='$vpi'
  150. set network.wan.vci='$vci'
  151. set network.wan.encaps='$encaps'
  152. set network.wan.username='foo'
  153. set network.wan.password='bar'
  154. EOF
  155. }
  156.  
  157. set_adsl() {
  158. local fwannex=$1
  159. local annex=$2
  160. uci batch <<EOF
  161. set network.adsl='adsl-device'
  162. set network.adsl.fwannex='$fwannex'
  163. set network.adsl.annex='$annex'
  164. EOF
  165. }
  166.  
  167. . /lib/functions/uci-defaults.sh
  168. . /lib/lantiq.sh
  169.  
  170. touch /etc/config/network
  171.  
  172. ucidef_set_interface_loopback
  173. ucidef_set_interface_lan 'eth0'
  174.  
  175. vpi=1
  176. vci=32
  177. encaps="llc"
  178. payload="bridged"
  179. fwannex=$(lantiq_dsl_fwannex)
  180. board=$(lantiq_board_name)
  181. dsl=$(lantiq_soc_has_adsl)
  182.  
  183. case "$board" in
  184. # annex B with adm6996
  185. ARV4520PW|GIGASX76X)
  186. ucidef_set_interface_lan "eth0.1"
  187. ucidef_add_switch "eth0" "1" "1"
  188. ucidef_add_switch_vlan "eth0" "1" "1 2 3 4 5t"
  189. set_adsl "b" "b2p"
  190. [ -z "$dsl" ] || set_atm_wan "$vpi" "$vci" "$encaps" "$payload"
  191. ;;
  192.  
  193. # annex A with ar8316
  194. ARV4519PW|ARV7518PW)
  195. ucidef_set_interface_lan "eth0.1"
  196. ucidef_add_switch "eth0" "1" "1"
  197. ucidef_add_switch_vlan "eth0" "1" "0t 2 3 4 5"
  198. set_adsl "a" "a2p"
  199. [ -z "$dsl" ] || set_atm_wan "$vpi" "$vci" "$encaps" "$payload"
  200. ;;
  201.  
  202. # annex A with adm6996, uk adsl, no atm bridge
  203. BTHOMEHUBV2B|BT3HHA)
  204. ucidef_set_interface_lan "eth0.1"
  205. ucidef_add_switch "eth0" "1" "1"
  206. ucidef_add_switch_vlan "eth0" "1" "1 2 3 4 5t"
  207. set_adsl "$fwannex" "${fwannex}2p"
  208. set_wan 0 38 "vc" "pppoa"
  209. ;;
  210.  
  211. ARV7525PW|ARV4525PW|*)
  212. set_adsl "$fwannex" "${fwannex}2p"
  213. [ -z "$dsl" ] || set_atm_wan "$vpi" "$vci" "$encaps" "$payload"
  214. ;;
  215.  
  216. esac
  217.  
  218.  
  219. uci commit network
  220.  
  221. exit 0
Add Comment
Please, Sign In to add comment