mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 00:24:40 +00:00
DHCP: Update DNS with hostname only static entries (#4689)
DHCP static mappings that have a hostname configured but no IP address, now update the Outbound DNS entry with the IP assigned from the pool
This commit is contained in:
parent
a31ec3c1ec
commit
3ca57fae8b
@ -1092,6 +1092,7 @@ EOD;
|
||||
$dhhostname = str_replace(" ", "_", $sm['hostname']);
|
||||
$dhhostname = str_replace(".", "_", $dhhostname);
|
||||
$dhcpdconf .= " option host-name \"{$dhhostname}\";\n";
|
||||
$dhcpdconf .= " set hostname-override = config-option host-name;\n";
|
||||
}
|
||||
if (!empty($sm['filename'])) {
|
||||
$dhcpdconf .= " filename \"{$sm['filename']}\";\n";
|
||||
@ -1561,6 +1562,7 @@ EOD;
|
||||
$dhhostname = str_replace(" ", "_", $sm['hostname']);
|
||||
$dhhostname = str_replace(".", "_", $dhhostname);
|
||||
$dhcpdv6conf .= " option host-name {$dhhostname};\n";
|
||||
$dhcpdv6conf .= " set hostname-override = config-option host-name;\n";
|
||||
}
|
||||
if (!empty($sm['filename'])) {
|
||||
$dhcpdv6conf .= " filename \"{$sm['filename']}\";\n";
|
||||
|
||||
@ -57,6 +57,7 @@ class DHCPDLease(object):
|
||||
:param lines: lease section as list item
|
||||
:return: dictionary
|
||||
"""
|
||||
hostname_override = None
|
||||
lease = dict()
|
||||
lease['address'] = lines[0].split()[1]
|
||||
for line in lines:
|
||||
@ -73,10 +74,15 @@ class DHCPDLease(object):
|
||||
field_value = {'hardware-type': parts[1], 'mac-address': parts[2].split(';')[0]}
|
||||
elif field_name in('uid', 'client-hostname') and len(parts) >= 2 and parts[1].find('"') > -1:
|
||||
field_value = parts[1].split('"')[1]
|
||||
elif field_name == 'set' and len(parts) >= 4 and parts[1] == 'hostname-override' and parts[3].find('"') > -1:
|
||||
hostname_override = parts[3].split('"')[1]
|
||||
|
||||
if field_value is not None:
|
||||
lease[field_name] = field_value
|
||||
|
||||
if hostname_override is not None:
|
||||
lease['client-hostname'] = hostname_override
|
||||
|
||||
return lease
|
||||
|
||||
def watch(self):
|
||||
|
||||
@ -354,7 +354,6 @@ include("head.inc");
|
||||
<input name="hostname" type="text" value="<?=$pconfig['hostname'];?>" />
|
||||
<div class="hidden" data-for="help_for_hostname">
|
||||
<?=gettext("Name of the host, without domain part.");?>
|
||||
<?=gettext("If no IP address is given above, hostname will not be visible to DNS services with lease registration enabled.");?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -207,7 +207,6 @@ include("head.inc");
|
||||
<input name="hostname" type="text" value="<?=$pconfig['hostname'];?>" />
|
||||
<div class="hidden" data-for="help_for_hostname">
|
||||
<?=gettext("Name of the host, without domain part.");?>
|
||||
<?=gettext("If no IP address is given above, hostname will not be visible to DNS services with lease registration enabled.");?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user