You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
2.0 KiB

  1. #!/bin/sh /etc/rc.common
  2. START=30
  3. STOP=90
  4. config_cb() {
  5. chilli_inst=$2
  6. if [ "$chilli_inst" != "" ]
  7. then
  8. rm -f /var/run/chilli_${chilli_inst}*
  9. chilli_conf=/var/run/chilli_${chilli_inst}.conf
  10. eval "start_chilli_$chilli_inst=1"
  11. fi
  12. }
  13. option_cb() {
  14. case "$1" in
  15. # UCI settings
  16. network)
  17. . /lib/functions/network.sh
  18. local ifname
  19. network_get_device ifname $2
  20. echo "dhcpif=\"$ifname\"" >> $chilli_conf
  21. ;;
  22. disabled)
  23. eval "start_chilli_$chilli_inst=0"
  24. ;;
  25. # boolean settings
  26. dhcpbroadcast|nodynip|vlanlocation|locationstopstart|locationcopycalled|locationimmediateupdate|locationopt82|coanoipcheck|noradallow|proxymacaccept|proxyonacct|dhcpmacset|dhcpradius|noc2c|eapolenable|uamanydns|uamanyip|uamnatanyip|nouamsuccess|nowispr1|nowispr2|domaindnslocal|radsec|macauth|macreauth|macauthdeny|macallowlocal|strictmacauth|strictdhcp|ieee8021q|only8021q|radiusoriginalurl|swapoctets|statusfilesave|wpaguests|openidauth|papalwaysok|mschapv2|chillixml|acctupdate|dnsparanoia|seskeepalive|usetap|noarpentries|framedservice|scalewin|redir|injectwispr|redirurl|routeonetone|nousergardendata|uamgardendata|uamotherdata|withunixipc|uamallowpost|redirssl|uamuissl|layer3|patricia|redirdnsreq|dhcpnotidle|ipv6|ipv6only)
  27. [ "$2" = "true" -o "$2" = "1" ] && echo "$1" >> $chilli_conf
  28. ;;
  29. *)
  30. echo "$1=\"$2\"" >> $chilli_conf
  31. ;;
  32. esac
  33. }
  34. start_chilli() {
  35. local cfg="$1"
  36. local start_chilli=$(eval "echo \$start_chilli_$cfg")
  37. [ "$start_chilli" = "0" ] && return
  38. local base=/var/run/chilli_${cfg}
  39. chilli -c ${base}.conf \
  40. --pidfile ${base}.pid \
  41. --cmdsocket ${base}.sock \
  42. --unixipc ${base}.ipc &
  43. }
  44. start() {
  45. config_load chilli
  46. config_foreach start_chilli chilli
  47. }
  48. stop() {
  49. ls /var/run/chilli*.pid 2>/dev/null && {
  50. kill $(cat /var/run/chilli*.pid)
  51. sleep 1
  52. killall -9 chilli
  53. rm -f /var/run/chilli*
  54. }
  55. }