Skip to content

Commit

Permalink
Do not apply a DHCP static mapping uniqueness test for hostnames or I…
Browse files Browse the repository at this point in the history
…P addresses. The DHCP daemon allows the entries to be duplicated provided they have unique MAC addresses or identifiers. Fixes #8220
  • Loading branch information
jim-p committed Feb 6, 2018
1 parent c971ddc commit b260591
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/usr/local/www/services_dhcp_edit.php
Expand Up @@ -185,16 +185,9 @@ function staticmaps_sort($ifgui) {
if (isset($id) && ($a_maps[$id]) && ($a_maps[$id] === $mapent)) {
continue;
}
/* The fully qualified hostname (hostname + '.' + domainname) must be unique.
* The unqualified hostname does not have to be unique as long as the fully
* qualified hostname is unique. */
$existingFqn = "{$mapent['hostname']}.{$mapent['domain']}";
$candidateFqn = "{$_POST['hostname']}.{$_POST['domain']}";
if ((($existingFqn == $candidateFqn) && $mapent['hostname']) ||
(($mapent['mac'] == $_POST['mac']) && $mapent['mac']) ||
(($mapent['ipaddr'] == $_POST['ipaddr']) && $mapent['ipaddr']) ||
if ((($mapent['mac'] == $_POST['mac']) && $mapent['mac']) ||
(($mapent['cid'] == $_POST['cid']) && $mapent['cid'])) {
$input_errors[] = gettext("This fully qualified hostname (Hostname + Domainname), IP, MAC address or Client identifier already exists.");
$input_errors[] = gettext("This MAC address or Client identifier already exists.");
break;
}
}
Expand Down Expand Up @@ -439,7 +432,8 @@ function staticmaps_sort($ifgui) {
$pconfig['ipaddr'],
'V4'
))->setHelp('If an IPv4 address is entered, the address must be outside of the pool.%1$s' .
'If no IPv4 address is given, one will be dynamically allocated from the pool.', '<br />');
'If no IPv4 address is given, one will be dynamically allocated from the pool.%1$s%1$s' .
'The same IP address may be assigned to multiple mappings.', '<br />');

$section->addInput(new Form_Input(
'hostname',
Expand Down

0 comments on commit b260591

Please sign in to comment.