2018-03-09 05:15:35 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
|
|
|
|
|
|
|
USE_PROCD=1
|
|
|
|
START=95
|
|
|
|
|
|
|
|
BIN=/usr/bin/wifidog-ng
|
|
|
|
|
2018-03-17 04:45:46 +00:00
|
|
|
parse_whitelist() {
|
|
|
|
local cfg="$1"
|
|
|
|
local domain mac
|
|
|
|
|
|
|
|
uci_validate_section wifidog-ng whitelist "${1}" \
|
|
|
|
'domain:list(host)' \
|
|
|
|
'mac:list(macaddr)'
|
|
|
|
|
|
|
|
[ $? -ne 0 ] && {
|
|
|
|
echo "validation failed" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
for m in $mac; do
|
|
|
|
echo "!$m" > /proc/wifidog-ng/term
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2018-03-09 05:15:35 +00:00
|
|
|
start_service() {
|
|
|
|
modprobe wifidog-ng
|
|
|
|
|
2018-03-25 04:23:30 +00:00
|
|
|
ipset create wifidog-ng-mac hash:mac
|
|
|
|
ipset create wifidog-ng-ip hash:ip timeout 10000
|
|
|
|
|
2018-03-17 04:45:46 +00:00
|
|
|
config_load wifidog-ng
|
|
|
|
config_foreach parse_whitelist whitelist
|
|
|
|
|
2018-03-09 05:15:35 +00:00
|
|
|
procd_open_instance
|
|
|
|
procd_set_param command $BIN
|
|
|
|
procd_set_param respawn
|
|
|
|
procd_close_instance
|
|
|
|
}
|
|
|
|
|
|
|
|
stop_service() {
|
|
|
|
rmmod wifidog-ng
|
2018-03-25 04:23:30 +00:00
|
|
|
|
|
|
|
ipset destroy wifidog-ng-mac
|
|
|
|
ipset destroy wifidog-ng-ip
|
2018-03-09 05:15:35 +00:00
|
|
|
}
|