Also allow (manually set dhcp-host=hostname,ip.add.re.ss) in table. As this has been added manually, don't allow deleting it

This commit is contained in:
DL6ER
2017-01-25 13:08:36 +01:00
parent b9f1c57bbb
commit 3ba37d7793
2 changed files with 6 additions and 2 deletions

View File

@@ -53,7 +53,7 @@ function readStaticLeasesFile()
// Remove any possibly existing variable with this name
$mac = ""; $one = ""; $two = "";
sscanf(trim(fgets($dhcpstatic)),"dhcp-host=%[^,],%[^,],%[^,]",$mac,$one,$two);
if(strlen($mac) > 0)
if(strlen($mac) > 0 && validMAC($mac))
{
if(validIP($one) && strlen($two) == 0)
array_push($dhcp_static_leases,["hwaddr"=>$mac, "IP"=>$one, "host"=>""]);
@@ -62,6 +62,10 @@ function readStaticLeasesFile()
else
array_push($dhcp_static_leases,["hwaddr"=>$mac, "IP"=>$one, "host"=>$two]);
}
else if(validIP($one) && validDomain($mac))
{
array_push($dhcp_static_leases,["hwaddr"=>"", "IP"=>$one, "host"=>$mac]);
}
}
return true;
}