summaryrefslogtreecommitdiff
path: root/examples/var_service/fw
diff options
context:
space:
mode:
authorDenys Vlasenko2018-03-30 20:49:16 +0200
committerDenys Vlasenko2018-03-30 20:49:16 +0200
commitdf65dc89b428c8f66ee2203f4a14eb2592d89ee0 (patch)
tree30fe6378dbeb4f594099b2fc26e3037729d4dfeb /examples/var_service/fw
parentd9503224c8a93a30b0c8627084b2744d3ee6f403 (diff)
downloadbusybox-df65dc89b428c8f66ee2203f4a14eb2592d89ee0.zip
busybox-df65dc89b428c8f66ee2203f4a14eb2592d89ee0.tar.gz
examples/var_service: new example: dnsmasq service
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'examples/var_service/fw')
-rw-r--r--examples/var_service/fw/etc/dnsmasq_servers.conf38
1 files changed, 38 insertions, 0 deletions
diff --git a/examples/var_service/fw/etc/dnsmasq_servers.conf b/examples/var_service/fw/etc/dnsmasq_servers.conf
new file mode 100644
index 0000000..6831360
--- /dev/null
+++ b/examples/var_service/fw/etc/dnsmasq_servers.conf
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+empty=true
+
+prio=0
+i=0; while test "${if[$i]}"; do
+ test x"${dns_prio[$i]}" != x"" \
+ && test "${dns_prio[$i]}" -gt "$prio" \
+ && prio="${dns_prio[$i]}"
+let i++; done
+
+i=0; while test "${if[$i]}"; do
+ if test "${dnsmasq[$i]}"; then
+ for d in ${dnsmasq[$i]}; do
+ echo "$d"
+ empty=false
+ done
+ let i++;
+ continue
+ fi
+ # This iface has no dnsmasq-extended config.
+ # Use simple DNS names instead, if those exist.
+ for d in ${dns[$i]}; do
+ p="${dns_prio[$i]}"
+ test x"$p" == x"" && p=0
+ test x"$p" == x"$prio" || continue
+ echo "server=$d"
+ empty=false
+ done
+ let i++;
+done
+
+# Use Google DNS servers if nothing else is configured
+$empty && echo "server=8.8.8.8"
+$empty && echo "server=8.8.4.4"
+
+# SIGHUP: make dnsmasq reload config
+sv h dnsmasq