1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2013 OpenWrt.org
11 . /lib/functions/network.sh
14 if network_find_wan tmp && network_get_dnsserver tmp "$tmp"; then
26 config_get ipset "$cfg" ipset
28 echo "No ipset specified for instance $cfg" >&2
32 config_get dns "$cfg" dns "$DEFNS"
34 echo "No DNS server specified for instance $cfg" >&2
38 config_get port "$cfg" port $((PORT++))
40 SERVICE_PID_FILE="/var/run/ipset-dns-$port.pid" \
41 service_start /usr/sbin/ipset-dns "$ipset" "$port" "$dns"
46 DEFNS="$(find_nameserver)"
48 # required by ipset-dns to not daemonize itself
52 config_foreach start_instance ipset-dns
57 for pid in /var/run/ipset-dns-*.pid; do
58 [ -f "$pid" ] || continue
59 SERVICE_PID_FILE="$pid" \
60 service_stop /usr/sbin/ipset-dns