diff --git a/src/etc/inc/plugins.inc.d/dnsmasq.inc b/src/etc/inc/plugins.inc.d/dnsmasq.inc
index 54a195dfe..82e490dde 100644
--- a/src/etc/inc/plugins.inc.d/dnsmasq.inc
+++ b/src/etc/inc/plugins.inc.d/dnsmasq.inc
@@ -265,8 +265,20 @@ function _dnsmasq_add_host_entries()
}
$domain = $config['system']['domain'];
- if ($host['domain']) {
+ // set domain to first entry of host's domain search list
+ if ($host['domainsearchlist']) {
+ $domain_array=preg_split("/[ ;]+/",$host['domainsearchlist']);
+ $domain = $domain_array[0];
+ // backward compatibilty: 'domain' was replaced by 'domainsearchlist'
+ // in dhcpv6 static mappings, but may still exist in older configs
+ } elseif ($host['domain']) {
$domain = $host['domain'];
+ // set domain to first entry of interface's domain search list
+ } elseif ($dhcpifconf['domainsearchlist']) {
+ $domain_array=preg_split("/[ ;]+/",$dhcpifconf['domainsearchlist']);
+ $domain = $domain_array[0];
+ // backward compatibilty: 'domain' was removed from dhcpv6
+ // interface settings, but may still exist in older configs
} elseif ($dhcpifconf['domain']) {
$domain = $dhcpifconf['domain'];
}
diff --git a/src/etc/inc/plugins.inc.d/unbound.inc b/src/etc/inc/plugins.inc.d/unbound.inc
index d97c5767a..88ba55c3d 100644
--- a/src/etc/inc/plugins.inc.d/unbound.inc
+++ b/src/etc/inc/plugins.inc.d/unbound.inc
@@ -680,8 +680,20 @@ function unbound_add_host_entries()
}
$domain = $config['system']['domain'];
- if ($host['domain']) {
+ // set domain to first entry of host's domain search list
+ if ($host['domainsearchlist']) {
+ $domain_array=preg_split("/[ ;]+/",$host['domainsearchlist']);
+ $domain = $domain_array[0];
+ // backward compatibilty: 'domain' was replaced by 'domainsearchlist'
+ // in dhcpv6 static mappings, but may still exist in older configs
+ } elseif ($host['domain']) {
$domain = $host['domain'];
+ // set domain to first entry of interface's domain search list
+ } elseif ($dhcpifconf['domainsearchlist']) {
+ $domain_array=preg_split("/[ ;]+/",$dhcpifconf['domainsearchlist']);
+ $domain = $domain_array[0];
+ // backward compatibilty: 'domain' was removed from dhcpv6
+ // interface settings, but may still exist in older configs
} elseif ($dhcpifconf['domain']) {
$domain = $dhcpifconf['domain'];
}
diff --git a/src/www/services_dhcpv6.php b/src/www/services_dhcpv6.php
index 9325baf4a..da5c248b1 100644
--- a/src/www/services_dhcpv6.php
+++ b/src/www/services_dhcpv6.php
@@ -63,7 +63,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['prefixrange_to'] = $config['dhcpdv6'][$if]['prefixrange']['to'];
$pconfig['prefixrange_length'] = $config['dhcpdv6'][$if]['prefixrange']['prefixlength'];
}
- $config_copy_fieldsnames = array('defaultleasetime', 'maxleasetime', 'domainsearchlist', 'ddnsdomain',
+ $config_copy_fieldsnames = array('defaultleasetime', 'maxleasetime', 'domain', 'domainsearchlist', 'ddnsdomain',
'ddnsdomainprimary', 'ddnsdomainkeyname', 'ddnsdomainkey', 'ddnsdomainalgorithm', 'bootfile_url', 'netmask',
'numberoptions', 'dhcpv6leaseinlocaltime', 'staticmap');
foreach ($config_copy_fieldsnames as $fieldname) {
@@ -86,6 +86,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['ntp1'] = !empty($config['dhcpdv6'][$if]['ntpserver'][0]) ? $config['dhcpdv6'][$if]['ntpserver'][0] : "";
$pconfig['ntp2'] = !empty($config['dhcpdv6'][$if]['ntpserver'][1]) ? $config['dhcpdv6'][$if]['ntpserver'][1] : "";
+ // backward compatibility: migrate 'domain' to 'domainsearchlist'
+ if (empty($pconfig['domainsearchlist'])) {
+ $pconfig['domainsearchlist'] = $pconfig['domain'];
+ }
+
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
// handle identifiers and actions
if (!empty($_POST['if']) && !empty($config['interfaces'][$_POST['if']])) {
@@ -558,7 +563,7 @@ if (isset($config['interfaces'][$if]['dhcpd6track6allowoverride'])) {
- =gettext("The default is to use the domain name of this system as the domain search list option provided by DHCPv6. You may optionally specify one or multiple domain(s) here. Use the semicolon character as separator.");?>
+ =gettext("The default is to use the domain name of this system as the domain search list option provided by DHCPv6. You may optionally specify one or multiple domain(s) here. Use the semicolon character as separator. The first domain in this list will also be used for DNS registration of DHCP static mappings (if enabled).");?>
- =gettext("The default is to use the domain name of this system as the domain search list option provided by DHCPv6. You may optionally specify one or multiple domain(s) here. Use the semicolon character as separator.");?>
+ =gettext("If you want to use a custom domain search list for this host, you may optionally specify one or multiple domain(s) here. " .
+ "Use the semicolon character as separator. The first domain in this list will also be used for DNS registration of this host (if enabled). " .
+ "(If empty, the first domain in the interface's domain search list will be used. If this is empty, too, the system domain will be used.)");?>
= gettext("If this option is set, then machines that specify " .
- "their hostname when requesting a DHCP lease will be registered " .
+ "their hostname when requesting a DHCPv4 lease will be registered " .
"in Dnsmasq, so that their name can be resolved.") ?>
- = sprintf(gettext("If this option is set, then DHCP static mappings will ".
+ = sprintf(gettext("If this option is set, then DHCPv6 and DHCPv4 static mappings will ".
"be registered in Dnsmasq, so that their name can be ".
"resolved. You should also set the domain in %s".
- "System: General setup%s to the proper value."),'','');?>
+ "System: General setup%s, in the DHCP server settings or for specific static mappings."),'','');?>
= gettext("If this option is set, then machines that specify " .
- "their hostname when requesting a DHCP lease will be registered " .
+ "their hostname when requesting a DHCPv4 lease will be registered " .
"in Unbound, so that their name can be resolved."); ?>
- = sprintf(gettext("If this option is set, then DHCP static mappings will ".
+ = sprintf(gettext("If this option is set, then DHCPv6 and DHCPv4 static mappings will ".
"be registered in Unbound, so that their name can be ".
"resolved. You should also set the domain in %s".
- "System: General setup%s to the proper value."),'','');?>
+ "System: General setup%s, in the DHCP server settings or for specific static mappings."),'','');?>