mirror of
https://github.com/pi-hole/pi-hole
synced 2025-01-03 12:40:56 +00:00
Backend accept and apply dhcp lease time
This commit is contained in:
parent
cf724176dc
commit
3268e1611a
@ -187,13 +187,19 @@ ProcessDHCPSettings() {
|
|||||||
interface="eth0"
|
interface="eth0"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "${DHCP_LEASETIME}" == "0" ]]; then
|
||||||
|
leasetime="infinite"
|
||||||
|
else
|
||||||
|
leasetime="${DHCP_LEASETIME}h"
|
||||||
|
fi
|
||||||
|
|
||||||
# Write settings to file
|
# Write settings to file
|
||||||
echo "###############################################################################
|
echo "###############################################################################
|
||||||
# DHCP SERVER CONFIG FILE AUTOMATICALLY POPULATED BY PI-HOLE WEB INTERFACE. #
|
# DHCP SERVER CONFIG FILE AUTOMATICALLY POPULATED BY PI-HOLE WEB INTERFACE. #
|
||||||
# ANY CHANGES MADE TO THIS FILE WILL BE LOST ON CHANGE #
|
# ANY CHANGES MADE TO THIS FILE WILL BE LOST ON CHANGE #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
dhcp-authoritative
|
dhcp-authoritative
|
||||||
dhcp-range=${DHCP_START},${DHCP_END},infinite
|
dhcp-range=${DHCP_START},${DHCP_END},${leasetime}
|
||||||
dhcp-option=option:router,${DHCP_ROUTER}
|
dhcp-option=option:router,${DHCP_ROUTER}
|
||||||
dhcp-leasefile=/etc/pihole/dhcp.leases
|
dhcp-leasefile=/etc/pihole/dhcp.leases
|
||||||
domain=${PIHOLE_DOMAIN}
|
domain=${PIHOLE_DOMAIN}
|
||||||
@ -213,6 +219,8 @@ EnableDHCP(){
|
|||||||
change_setting "DHCP_START" "${args[2]}"
|
change_setting "DHCP_START" "${args[2]}"
|
||||||
change_setting "DHCP_END" "${args[3]}"
|
change_setting "DHCP_END" "${args[3]}"
|
||||||
change_setting "DHCP_ROUTER" "${args[4]}"
|
change_setting "DHCP_ROUTER" "${args[4]}"
|
||||||
|
change_setting "DHCP_LEASETIME" "${args[5]}"
|
||||||
|
change_setting "PIHOLE_DOMAIN" "${args[6]}"
|
||||||
|
|
||||||
# Remove possible old setting from file
|
# Remove possible old setting from file
|
||||||
delete_dnsmasq_setting "dhcp-"
|
delete_dnsmasq_setting "dhcp-"
|
||||||
@ -242,16 +250,6 @@ SetWebUILayout(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetDHCPDomainName(){
|
|
||||||
|
|
||||||
change_setting "PIHOLE_DOMAIN" "${args[2]}"
|
|
||||||
|
|
||||||
ProcessDHCPSettings
|
|
||||||
|
|
||||||
RestartDNS
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
SetPrivacyMode(){
|
SetPrivacyMode(){
|
||||||
|
|
||||||
if [[ "${args[2]}" == "true" ]] ; then
|
if [[ "${args[2]}" == "true" ]] ; then
|
||||||
@ -293,7 +291,6 @@ main() {
|
|||||||
"disabledhcp" ) DisableDHCP;;
|
"disabledhcp" ) DisableDHCP;;
|
||||||
"layout" ) SetWebUILayout;;
|
"layout" ) SetWebUILayout;;
|
||||||
"-h" | "--help" ) helpFunc;;
|
"-h" | "--help" ) helpFunc;;
|
||||||
"domainname" ) SetDHCPDomainName;;
|
|
||||||
"privacymode" ) SetPrivacyMode;;
|
"privacymode" ) SetPrivacyMode;;
|
||||||
"resolve" ) ResolutionSettings;;
|
"resolve" ) ResolutionSettings;;
|
||||||
* ) helpFunc;;
|
* ) helpFunc;;
|
||||||
|
Loading…
Reference in New Issue
Block a user