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.

49 lines
884 B

  1. #!/bin/sh /etc/rc.common
  2. USE_PROCD=1
  3. START=95
  4. BIN=/usr/bin/wifidog-ng
  5. parse_whitelist_mac() {
  6. local cfg="$1"
  7. local mac
  8. uci_validate_section wifidog-ng whitelist "${1}" \
  9. 'mac:macaddr'
  10. [ $? -ne 0 ] && {
  11. echo "validation whitelist_mac failed" >&2
  12. exit 1
  13. }
  14. }
  15. parse_whitelist_domain() {
  16. local cfg="$1"
  17. local domain
  18. uci_validate_section wifidog-ng whitelist "${1}" \
  19. 'domain:host'
  20. [ $? -ne 0 ] && {
  21. echo "validation whitelist_domain failed" >&2
  22. exit 1
  23. }
  24. }
  25. start_service() {
  26. modprobe wifidog-ng
  27. config_load wifidog-ng
  28. config_foreach parse_whitelist_mac whitelist_mac
  29. config_foreach parse_whitelist_domain whitelist_domain
  30. procd_open_instance
  31. procd_set_param command $BIN
  32. procd_set_param respawn
  33. procd_close_instance
  34. }
  35. stop_service() {
  36. rmmod wifidog-ng
  37. }