Merge pull request #980 from pi-hole/fix/duplicate-static-dhcp-hostnames

Prevent static DHCP leases from having duplicate hostnames
This commit is contained in:
Mark Drobnak
2019-07-10 12:52:38 -04:00
committed by GitHub
+6 -1
View File
@@ -565,7 +565,7 @@ function readAdlists()
if(strlen($ip) == 0)
$ip = "noip";
// Test if this MAC address is already included
// Test if this lease is already included
readStaticLeasesFile();
foreach($dhcp_static_leases as $lease) {
if($lease["hwaddr"] === $mac)
@@ -578,6 +578,11 @@ function readAdlists()
$error .= "Static lease for IP address (".htmlspecialchars($ip).") already defined!<br>";
break;
}
if($lease["host"] === $hostname)
{
$error .= "Static lease for hostname (".htmlspecialchars($hostname).") already defined!<br>";
break;
}
}
if(!strlen($error))