br2684ctl 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #!/bin/sh /etc/rc.common
  2. START=50
  3. SERVICE_DAEMONIZE=1
  4. SERVICE_WRITE_PID=1
  5. start_daemon() {
  6. . /lib/functions/network.sh
  7. local cfg="$1"
  8. local atmdev
  9. config_get atmdev "$cfg" atmdev 0
  10. local unit
  11. config_get unit "$cfg" unit 0
  12. local vpi
  13. config_get vpi "$cfg" vpi 8
  14. local vci
  15. config_get vci "$cfg" vci 35
  16. local encaps
  17. config_get encaps "$cfg" encaps
  18. case "$encaps" in
  19. 1|vc) encaps=1;;
  20. *) encaps=0;;
  21. esac
  22. local payload
  23. config_get payload "$cfg" payload
  24. case "$payload" in
  25. 0|routed) payload=0;;
  26. *) payload=1;;
  27. esac
  28. local qos
  29. config_get qos "$cfg" qos
  30. local sendsize
  31. config_get sendsize "$cfg" sendsize
  32. local circuit="$atmdev.$vpi.$vci"
  33. network_defer_device "nas$unit"
  34. SERVICE_PID_FILE="/var/run/br2684ctl-$circuit.pid" \
  35. service_start /usr/sbin/br2684ctl \
  36. -c "$unit" -e "$encaps" -p "$payload" \
  37. -a "$circuit" ${qos:+-q "$qos"} ${sendsize:+-s "$sendsize"}
  38. sleep 1
  39. network_ready_device "nas$unit"
  40. }
  41. stop_daemon() {
  42. local cfg="$1"
  43. local atmdev
  44. config_get atmdev "$cfg" atmdev 0
  45. local unit
  46. config_get unit "$cfg" unit 0
  47. local vpi
  48. config_get vpi "$cfg" vpi 8
  49. local vci
  50. config_get vci "$cfg" vci 35
  51. local circuit="$atmdev.$vpi.$vci"
  52. SERVICE_PID_FILE="/var/run/br2684ctl-$circuit.pid" \
  53. service_stop /usr/sbin/br2684ctl
  54. }
  55. start() {
  56. config_load network
  57. config_foreach start_daemon atm-bridge
  58. }
  59. stop() {
  60. config_load network
  61. config_foreach stop_daemon atm-bridge
  62. }