mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-25 06:10:20 +00:00
Setup interface listening behavior of dnsmasq
This commit is contained in:
parent
f6fc6a5e56
commit
de6c43a8d3
1 changed files with 34 additions and 0 deletions
|
@ -27,6 +27,11 @@ helpFunc() {
|
||||||
::: -f, fahrenheit Set Fahrenheit temperature unit
|
::: -f, fahrenheit Set Fahrenheit temperature unit
|
||||||
::: -k, kelvin Set Kelvin temperature unit
|
::: -k, kelvin Set Kelvin temperature unit
|
||||||
::: -h, --help Show this help dialog
|
::: -h, --help Show this help dialog
|
||||||
|
::: listening Setup interface listening behavior of dnsmasq
|
||||||
|
::: pihole -a listening allinterfaces : Listen on all interfaces, permit all origins
|
||||||
|
::: pihole -a listening gravityinterface : Listen only on one interface (see PIHOLE_INTERFACE)
|
||||||
|
::: pihole -a listening localsubnets : Listen only on all interfaces, but allow only
|
||||||
|
::: devices that at most one hop away (local devices)
|
||||||
EOM
|
EOM
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
@ -133,6 +138,22 @@ trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE3
|
||||||
add_dnsmasq_setting "host-record" "${HOSTRECORD}"
|
add_dnsmasq_setting "host-record" "${HOSTRECORD}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Setup interface listening behavior of dnsmasq
|
||||||
|
delete_dnsmasq_setting "interface"
|
||||||
|
delete_dnsmasq_setting "local-service"
|
||||||
|
|
||||||
|
if [[ "${DNSMASQ_LISTENING}" == "allinterfaces" ]]; then
|
||||||
|
# Listen on all interfaces, permit all origins
|
||||||
|
# Leave a comment in 01-pihole.conf
|
||||||
|
add_dnsmasq_setting "# Listening on all interfaces"
|
||||||
|
elif [[ "${DNSMASQ_LISTENING}" == "gravityinterface" ]]; then
|
||||||
|
# Listen only on one interface
|
||||||
|
add_dnsmasq_setting "interface" "${PIHOLE_INTERFACE}"
|
||||||
|
else
|
||||||
|
# Listen only on all interfaces, but only local subnets
|
||||||
|
add_dnsmasq_setting "local-service"
|
||||||
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetDNSServers(){
|
SetDNSServers(){
|
||||||
|
@ -365,6 +386,18 @@ SetHostRecord(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetListeningMode(){
|
||||||
|
|
||||||
|
if [[ "${args[2]}" == "allinterfaces" ]] ; then
|
||||||
|
change_setting "DNSMASQ_LISTENING" "allinterfaces"
|
||||||
|
elif [[ "${args[2]}" == "gravityinterface" ]] ; then
|
||||||
|
change_setting "DNSMASQ_LISTENING" "gravityinterface"
|
||||||
|
else
|
||||||
|
change_setting "DNSMASQ_LISTENING" "localsubnets"
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
|
||||||
args=("$@")
|
args=("$@")
|
||||||
|
@ -389,6 +422,7 @@ main() {
|
||||||
"addstaticdhcp" ) AddDHCPStaticAddress;;
|
"addstaticdhcp" ) AddDHCPStaticAddress;;
|
||||||
"removestaticdhcp" ) RemoveDHCPStaticAddress;;
|
"removestaticdhcp" ) RemoveDHCPStaticAddress;;
|
||||||
"hostrecord" ) SetHostRecord;;
|
"hostrecord" ) SetHostRecord;;
|
||||||
|
"listening" ) SetListeningMode;;
|
||||||
* ) helpFunc;;
|
* ) helpFunc;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue