dhcpd4: support ignore-client-uids, Fixes opnsense#3673 (#4954)

This commit is contained in:
Kacper Why 2021-04-28 16:01:00 +02:00 committed by GitHub
parent 64e88b3360
commit ec400a0495
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -840,6 +840,10 @@ EOPP;
$dhcpdconf .= " deny unknown-clients;\n";
}
if (isset($poolconf['ignoreuids'])) {
$dhcpdconf .= " ignore-client-uids true;\n";
}
if (
!empty($poolconf['gateway']) && $poolconf['gateway'] != "none"
&& (empty($dhcpifconf['gateway']) || $poolconf['gateway'] != $dhcpifconf['gateway'])

View File

@ -94,7 +94,7 @@ function reconfigure_dhcpd()
}
$config_copy_fieldsnames = array('enable', 'staticarp', 'failover_peerip', 'failover_split', 'dhcpleaseinlocaltime','descr',
'defaultleasetime', 'maxleasetime', 'gateway', 'domain', 'domainsearchlist', 'denyunknown', 'ddnsdomain',
'defaultleasetime', 'maxleasetime', 'gateway', 'domain', 'domainsearchlist', 'denyunknown','ignoreuids', 'ddnsdomain',
'ddnsdomainprimary', 'ddnsdomainkeyname', 'ddnsdomainkey', 'ddnsdomainalgorithm', 'ddnsupdate', 'mac_allow',
'mac_deny', 'tftp', 'bootfilename', 'ldap', 'netboot', 'nextserver', 'filename', 'filename32', 'filename64',
'rootpath', 'netmask', 'numberoptions', 'interface_mtu', 'wpad', 'omapi', 'omapiport', 'omapialgorithm', 'omapikey', 'minsecs');
@ -142,6 +142,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['wpad'] = isset($dhcpdconf['wpad']);
$pconfig['staticarp'] = isset($dhcpdconf['staticarp']);
$pconfig['denyunknown'] = isset($dhcpdconf['denyunknown']);
$pconfig['ignoreuids'] = isset($dhcpdconf['ignoreuids']);
$pconfig['ddnsupdate'] = isset($dhcpdconf['ddnsupdate']);
$pconfig['netboot'] = isset($dhcpdconf['netboot']);
@ -397,6 +398,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$dhcpdconf['enable'] = !empty($dhcpdconf['enable']);
$dhcpdconf['staticarp'] = !empty($dhcpdconf['staticarp']);
$dhcpdconf['denyunknown'] = !empty($dhcpdconf['denyunknown']);
$dhcpdconf['ignoreuids'] = !empty($dhcpdconf['ignoreuids']);
$dhcpdconf['ddnsupdate'] = !empty($dhcpdconf['ddnsupdate']);
$dhcpdconf['netboot'] = !empty($dhcpdconf['netboot']);
@ -678,6 +680,15 @@ include("head.inc");
</div>
</td>
</tr>
<tr>
<td><a id="help_for_ignoreuids" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Ignore Client UIDs");?></td>
<td>
<input name="ignoreuids" type="checkbox" value="yes" <?=!empty($pconfig['ignoreuids']) ? "checked=\"checked\"" : ""; ?> />
<div class="hidden" data-for="help_for_ignoreuids">
<?=gettext("By default, the same MAC can get multiple leases if the requests are sent using different UIDs. To avoid this behavior, check this box, and client UIDs will be ignored");?>
</div>
</td>
</tr>
<tr>
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Subnet");?></td>
<td>