diff --git a/scripts/pi-hole/php/FTL.php b/scripts/pi-hole/php/FTL.php index 958ac7bed..4ceba32c3 100644 --- a/scripts/pi-hole/php/FTL.php +++ b/scripts/pi-hole/php/FTL.php @@ -8,12 +8,12 @@ $piholeFTLConfFile = "/etc/pihole/pihole-FTL.conf"; -function piholeFTLConfig() +function piholeFTLConfig($force=false) { static $piholeFTLConfig; global $piholeFTLConfFile; - if(isset($piholeFTLConfig)) + if(isset($piholeFTLConfig) && !$force) { return $piholeFTLConfig; } diff --git a/scripts/pi-hole/php/savesettings.php b/scripts/pi-hole/php/savesettings.php index edfd72b8c..6178902eb 100644 --- a/scripts/pi-hole/php/savesettings.php +++ b/scripts/pi-hole/php/savesettings.php @@ -352,6 +352,13 @@ function addStaticDHCPLease($mac, $ip, $hostname) { } pihole_execute("-a -i ".$DNSinterface." -web"); + // Add rate-limiting settings + if(isset($_POST["rate_limit_count"]) && isset($_POST["rate_limit_interval"])) + { + // Restart of FTL is delayed + pihole_execute("-a ratelimit " . intval($_POST["rate_limit_count"]) . " " . intval($_POST["rate_limit_interval"]) . " false"); + } + // If there has been no error we can save the new DNS server IPs if(!strlen($error)) { diff --git a/settings.php b/settings.php index e59b13523..c7e6e21bc 100644 --- a/settings.php +++ b/settings.php @@ -10,7 +10,7 @@ require_once "scripts/pi-hole/php/FTL.php"; // Reread ini file as things might have been changed $setupVars = parse_ini_file("/etc/pihole/setupVars.conf"); -$piholeFTLConf = piholeFTLConfig(); +$piholeFTLConf = piholeFTLConfig(true); // Handling of PHP internal errors $last_error = error_get_last(); @@ -718,6 +718,19 @@ function convertseconds($argument) +