aboutsummaryrefslogtreecommitdiff
path: root/examples/var_service/fw/etc/dnsmasq_servers.conf
blob: c39fe6e43bec73a850fbcfdb41970151680b525e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
svc -h dnsmasq