1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-11-20 15:18:32 +00:00

Merge pull request #1135 from pi-hole/new/multipleDNSservers

Allow multiple DNS servers
This commit is contained in:
DL6ER 2017-01-13 23:48:38 +01:00 committed by GitHub
commit 08f08fea61

View File

@ -92,12 +92,17 @@ SetWebPassword(){
ProcessDNSSettings() { ProcessDNSSettings() {
source "${setupVars}" source "${setupVars}"
delete_dnsmasq_setting "server=" delete_dnsmasq_setting "server"
add_dnsmasq_setting "server" "${PIHOLE_DNS_1}"
if [[ "${PIHOLE_DNS_2}" != "" ]]; then COUNTER=1
add_dnsmasq_setting "server" "${PIHOLE_DNS_2}" while [[ 1 ]]; do
var=PIHOLE_DNS_${COUNTER}
if [ -z "${!var}" ]; then
break;
fi fi
add_dnsmasq_setting "server" "${!var}"
let COUNTER=COUNTER+1
done
delete_dnsmasq_setting "domain-needed" delete_dnsmasq_setting "domain-needed"
@ -125,27 +130,26 @@ trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE3
SetDNSServers(){ SetDNSServers(){
# Save setting to file # Save setting to file
change_setting "PIHOLE_DNS_1" "${args[2]}" delete_setting "PIHOLE_DNS"
IFS=',' read -r -a array <<< "${args[2]}"
for index in "${!array[@]}"
do
add_setting "PIHOLE_DNS_$((index+1))" "${array[index]}"
done
if [[ "${args[3]}" != "none" ]]; then if [[ "${args[3]}" == "domain-needed" ]]; then
change_setting "PIHOLE_DNS_2" "${args[3]}"
else
change_setting "PIHOLE_DNS_2" ""
fi
if [[ "${args[4]}" == "domain-needed" ]]; then
change_setting "DNS_FQDN_REQUIRED" "true" change_setting "DNS_FQDN_REQUIRED" "true"
else else
change_setting "DNS_FQDN_REQUIRED" "false" change_setting "DNS_FQDN_REQUIRED" "false"
fi fi
if [[ "${args[5]}" == "bogus-priv" ]]; then if [[ "${args[4]}" == "bogus-priv" ]]; then
change_setting "DNS_BOGUS_PRIV" "true" change_setting "DNS_BOGUS_PRIV" "true"
else else
change_setting "DNS_BOGUS_PRIV" "false" change_setting "DNS_BOGUS_PRIV" "false"
fi fi
if [[ "${args[6]}" == "dnssec" ]]; then if [[ "${args[5]}" == "dnssec" ]]; then
change_setting "DNSSEC" "true" change_setting "DNSSEC" "true"
else else
change_setting "DNSSEC" "false" change_setting "DNSSEC" "false"