dnsmasq_servers.conf 769 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. empty=true
  3. prio=0
  4. i=0; while test "${if[$i]}"; do
  5. test x"${dns_prio[$i]}" != x"" \
  6. && test "${dns_prio[$i]}" -gt "$prio" \
  7. && prio="${dns_prio[$i]}"
  8. let i++; done
  9. i=0; while test "${if[$i]}"; do
  10. if test "${dnsmasq[$i]}"; then
  11. for d in ${dnsmasq[$i]}; do
  12. echo "$d"
  13. empty=false
  14. done
  15. let i++;
  16. continue
  17. fi
  18. # This iface has no dnsmasq-extended config.
  19. # Use simple DNS names instead, if those exist.
  20. for d in ${dns[$i]}; do
  21. p="${dns_prio[$i]}"
  22. test x"$p" == x"" && p=0
  23. test x"$p" == x"$prio" || continue
  24. echo "server=$d"
  25. empty=false
  26. done
  27. let i++;
  28. done
  29. # Use Google DNS servers if nothing else is configured
  30. $empty && echo "server=8.8.8.8"
  31. $empty && echo "server=8.8.4.4"
  32. # SIGHUP: make dnsmasq reload config
  33. svc -h dnsmasq