mirror of
https://github.com/opnsense/core.git
synced 2026-12-04 01:18:36 +00:00
Services: Kea DHCPv4/6: Align domain registration of static reservations with ddns_qualifying_suffix instead of overloading DHCP options (#11243)
* Services: Kea DHCPv4/6: Align domain registration of static reservations with ddns_qualifying_suffix instead of overloading DHCP options" * Fix small issue that when one address family was disabled it also skipped registration of the other
This commit is contained in:
1 parent
14dfa1cd3d
commit
fca582fab0
3 files changed
+21
-15
No files matched your search
@@ -86,11 +86,20 @@ function kea_staticmap($proto = null, $valid_addresses = true, $ifconfig_details
|
||||
}
|
||||
|
||||
if (empty((string)$keamdl->general->enabled)) {
|
||||
/* not enabled */
|
||||
return $staticmap;
|
||||
/* Skip only the disabled address family. */
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($keamdl->reservations->reservation->iterateItems() as $reservation) {
|
||||
$subnet_node = $keamdl->getNodeByReference("subnets.subnet{$proto}.{$reservation->subnet}");
|
||||
if ($subnet_node && !$subnet_node->ddns_dns_server->isEmpty()) {
|
||||
/*
|
||||
* DDNS manages this subnet's records on the upstream DNS server. Local static records in
|
||||
* Unbound or Dnsmasq could shadow those records and become stale, so skip registration here.
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
|
||||
$hostname = !empty((string)$reservation->hostname) ? (string)$reservation->hostname : null;
|
||||
$ip_address = (string)$reservation->ip_address;
|
||||
if ($valid_addresses) {
|
||||
@@ -109,16 +118,15 @@ function kea_staticmap($proto = null, $valid_addresses = true, $ifconfig_details
|
||||
|
||||
$description = !empty((string)$reservation->description) ? (string)$reservation->description : null;
|
||||
|
||||
/*
|
||||
* DHCP domain and search options configure client name resolution and may differ from the domain
|
||||
* used to register their hostnames. The dedicated qualifying suffix defines that registration domain
|
||||
* for both DHCPv4 and DHCPv6, which aligns most closely with Kea's own DDNS model. Neither subnet
|
||||
* nor reservation DHCP options are used here, since they should never influence this decision.
|
||||
*/
|
||||
$domain = null;
|
||||
if ($proto == 4) {
|
||||
$subnet_node = $keamdl->getNodeByReference("subnets.subnet4.{$reservation->subnet}");
|
||||
if ($subnet_node) {
|
||||
if (!empty((string)$reservation->option_data->domain_name)) {
|
||||
$domain = (string)$reservation->option_data->domain_name;
|
||||
} elseif (!empty((string)$subnet_node->option_data->domain_name)) {
|
||||
$domain = (string)$subnet_node->option_data->domain_name;
|
||||
}
|
||||
}
|
||||
if ($subnet_node && !$subnet_node->ddns_qualifying_suffix->isEmpty()) {
|
||||
$domain = $subnet_node->ddns_qualifying_suffix->getValue();
|
||||
}
|
||||
|
||||
$entry = [
|
||||
|
||||
@@ -275,7 +275,6 @@
|
||||
<field>
|
||||
<type>header</type>
|
||||
<label>Dynamic DNS</label>
|
||||
<collapse>true</collapse>
|
||||
</field>
|
||||
<field>
|
||||
<id>subnet4.ddns_forward_zone</id>
|
||||
@@ -300,7 +299,7 @@
|
||||
<id>subnet4.ddns_qualifying_suffix</id>
|
||||
<label>DNS qualifying suffix</label>
|
||||
<type>text</type>
|
||||
<help>If a DHCP client only sends a hostname in option 81, append this suffix to create an FQDN (e.g. "home.arpa.").</help>
|
||||
<help>If a DHCP client only sends a hostname in option 81, append this suffix to create an FQDN (e.g. "home.arpa."). Also used as the domain for static reservations when registration is enabled in local DNS services. Static registration is skipped when an upstream DNS server is configured for this subnet.</help>
|
||||
<grid_view>
|
||||
<visible>false</visible>
|
||||
</grid_view>
|
||||
|
||||
@@ -142,7 +142,6 @@
|
||||
<field>
|
||||
<type>header</type>
|
||||
<label>Dynamic DNS</label>
|
||||
<collapse>true</collapse>
|
||||
</field>
|
||||
<field>
|
||||
<id>subnet6.ddns_forward_zone</id>
|
||||
@@ -167,7 +166,7 @@
|
||||
<id>subnet6.ddns_qualifying_suffix</id>
|
||||
<label>DNS qualifying suffix</label>
|
||||
<type>text</type>
|
||||
<help>If a DHCP client only sends a hostname in option 81, append this suffix to create an FQDN (e.g. "home.arpa.").</help>
|
||||
<help>If a DHCP client only sends a hostname in option 81, append this suffix to create an FQDN (e.g. "home.arpa."). Also used as the domain for static reservations when registration is enabled in local DNS services. Static registration is skipped when an upstream DNS server is configured for this subnet.</help>
|
||||
<grid_view>
|
||||
<visible>false</visible>
|
||||
</grid_view>
|
||||
|
||||
Reference in new issue
Block a user