From 67784aa66f20a73d6d4e6f5099efb0db951e15d3 Mon Sep 17 00:00:00 2001 From: Steve Beaver Date: Fri, 2 Feb 2018 12:57:16 -0500 Subject: [PATCH] Add DDNS client update option to DHCPv4 configuraiton --- src/etc/inc/services.inc | 14 +++++++++++--- src/usr/local/www/services_dhcp.php | 26 ++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc index 9617fe9b97..1d23e1f033 100644 --- a/src/etc/inc/services.inc +++ b/src/etc/inc/services.inc @@ -693,6 +693,14 @@ EOPP; $newzone['domain-name'] = $config['system']['domain']; } + if (empty($dhcpifconf['ddnsclientupdates'])) { + $ddnsclientupdates = 'allow'; + } else { + $ddnsclientupdates = $dhcpifconf['ddnsclientupdates']; + } + + $dnscfg .= " {$ddnsclientupdates} client-updates;\n"; + $revsubnet = array_reverse(explode('.',$subnet)); /* Take care of full classes first */ @@ -2209,18 +2217,18 @@ function services_unbound_configure($restart_dhcp = true) { $wanif = get_real_interface("wan", "inet6"); if (platform_booting()) { for ($i=1; $i <= 10; $i++) { - if (!file_exists("/tmp/{$wanif}_dhcp6_complete")) { + if (!file_exists("/tmp/{$wanif}_dhcp6_complete")) { log_error(gettext("Unbound start waiting on dhcp6c.")); sleep(1); } else { unlink_if_exists("/tmp/{$wanif}_dhcp6_complete"); log_error(gettext("dhcp6 init complete. Continuing")); break; - } + } } } } - + sync_unbound_service(); if (platform_booting()) { log_error(gettext("sync unbound done.")); diff --git a/src/usr/local/www/services_dhcp.php b/src/usr/local/www/services_dhcp.php index fab7166b72..5c6746309e 100644 --- a/src/usr/local/www/services_dhcp.php +++ b/src/usr/local/www/services_dhcp.php @@ -201,6 +201,7 @@ if (is_array($dhcpdconf)) { $pconfig['netmask'] = $dhcpdconf['netmask']; $pconfig['numberoptions'] = $dhcpdconf['numberoptions']; $pconfig['statsgraph'] = $dhcpdconf['statsgraph']; + $pconfig['ddnsclientupdates'] = $dhcpdconf['ddnsclientupdates']; } $ifcfgip = $config['interfaces'][$if]['ipaddr']; @@ -585,6 +586,7 @@ if (isset($_POST['save'])) { $dhcpdconf['ddnsforcehostname'] = ($_POST['ddnsforcehostname']) ? true : false; $dhcpdconf['mac_allow'] = $_POST['mac_allow']; $dhcpdconf['mac_deny'] = $_POST['mac_deny']; + $dhcpdconf['ddnsclientupdates'] = $_POST['ddnsclientupdates']; unset($dhcpdconf['ntpserver']); if ($_POST['ntp1']) { @@ -1145,6 +1147,19 @@ $section->addInput(new Form_Input( $pconfig['ddnsdomainkey'] ))->setHelp('Dynamic DNS domain key secret which will be used to register client names in the DNS server.'); +$section->addInput(new Form_Select( + 'ddnsclientupdates', + 'DDNS Client Updates', + $pconfig['ddnsclientupdates'], + array( + 'allow' => gettext('Allow'), + 'deny' => gettext('Deny'), + 'ignore' => gettext('Ignore')) +))->setHelp('How Forward entries are handled when client indicates they wish to update DNS. ' . + 'Allow prevents DHCP from updating Forward entries, Deny indicates that DHCP will ' . + 'do the updates and the client should not, Ignore specifies that DHCP will do the ' . + 'update and the client can also attempt the update usually using a different domain name.'); + // Advanced MAC $btnadv = new Form_Button( 'btnadvmac', @@ -1535,8 +1550,14 @@ events.push(function() { // On page load decide the initial state based on the data. if (ispageload) { ";