Add static mapping interface not set when IP in a pool

If the DHCP IP address is in a pool (not in the main DHCP range for the interface) then the interface that corresponds to the IP address is not found. This results in the link to "add static mapping for this MAC address" not having any value for "if=" and thus clicking on the "+" button does not work.
Reported in bug 4649
Process any pools when checking for which interface contains the IP address.
This commit is contained in:
Phil Davis 2015-04-23 20:41:19 +05:45 committed by Renato Botelho
parent d7d6342c41
commit cf3aff59ed

View File

@ -371,6 +371,17 @@ foreach ($leases as $data) {
$data['if'] = $dhcpif;
break;
}
// Check if the IP is in the range of any DHCP pools
if (is_array($dhcpifconf['pool'])) {
foreach ($dhcpifconf['pool'] as $dhcppool) {
if (is_array($dhcppool['range'])) {
if (($lip >= ip2ulong($dhcppool['range']['from'])) && ($lip <= ip2ulong($dhcppool['range']['to']))) {
$data['if'] = $dhcpif;
break 2;
}
}
}
}
}
}
echo "<tr>\n";