2
0

br2684ctl 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #!/bin/sh /etc/rc.common
  2. START=50
  3. USE_PROCD=1
  4. start_daemon() {
  5. local cfg="$1"
  6. local atmdev disabled
  7. config_get_bool disabled "$cfg" disabled 0
  8. [ "$disabled" -eq 1 ] && return
  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. found=
  33. for device in /sys/class/atm/*; do
  34. [ -d "$device" ] || break
  35. [ "$(cat $device/atmindex)" = "$atmdev" ] || continue
  36. found=1
  37. break
  38. done
  39. [ -n "$found" ] || return
  40. local circuit="$atmdev.$vpi.$vci"
  41. procd_open_instance
  42. procd_set_param command \
  43. /usr/sbin/br2684ctl_wrap "nas$unit" \
  44. -c "$unit" -e "$encaps" -p "$payload" \
  45. -a "$circuit" ${qos:+-q "$qos"} ${sendsize:+-s "$sendsize"} \
  46. -S /lib/netifd/br2684-up
  47. procd_close_instance
  48. }
  49. service_triggers() {
  50. local script=$(readlink "$initscript")
  51. local name=$(basename ${script:-$initscript})
  52. procd_open_trigger
  53. procd_add_raw_trigger hotplug.atm 2000 /etc/init.d/$name reload
  54. procd_add_config_trigger "config.change" "network" /etc/init.d/$name reload
  55. procd_close_trigger
  56. }
  57. start_service() {
  58. config_load network
  59. config_foreach start_daemon atm-bridge
  60. }