Skip to content

Commit

Permalink
Prevent static DHCP leases from having duplicate hostnames
Browse files Browse the repository at this point in the history
Fixes #979

Signed-off-by: Mcat12 <[email protected]>
  • Loading branch information
AzureMarker committed Jul 10, 2019
1 parent 7784547 commit bc85bcd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/pi-hole/php/savesettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -578,6 +578,10 @@ 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>";
}
}

if(!strlen($error))
Expand Down

0 comments on commit bc85bcd

Please sign in to comment.