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
24 local ipset ipset6 port dns
26 config_get ipset "$cfg" ipset
27 config_get ipset6 "$cfg" ipset6
28 [ -n "$ipset$ipset6" ] || {
29 echo "No ipset specified for instance $cfg" >&2
33 config_get dns "$cfg" dns "$DEFNS"
35 echo "No DNS server specified for instance $cfg" >&2
39 config_get port "$cfg" port $((PORT++))
41 SERVICE_PID_FILE="/var/run/ipset-dns-$port.pid" \
42 service_start /usr/sbin/ipset-dns "$ipset" "$ipset6" "$port" "$dns"
47 DEFNS="$(find_nameserver)"
49 # required by ipset-dns to not daemonize itself
53 config_foreach start_instance ipset-dns
58 for pid in /var/run/ipset-dns-*.pid; do
59 [ -f "$pid" ] || continue
60 SERVICE_PID_FILE="$pid" \
61 service_stop /usr/sbin/ipset-dns