namespace isc {
namespace dhcp {
-namespace {
-
-// The following constants describe server's behavior with respect to the
-// DHCPv6 Client FQDN Option sent by a client. They will be removed
-// when DDNS parameters for DHCPv6 are implemented with the ticket #3034.
-
-// Do update, even if client requested no updates with N flag (Disabled).
-const bool FQDN_OVERRIDE_NO_UPDATE = false;
-// Server performs an update when client requested delegation (Enabled).
-const bool FQDN_OVERRIDE_CLIENT_UPDATE = true;
-// The fully qualified domain-name suffix if partial name provided by
-// a client.
-const char* FQDN_PARTIAL_SUFFIX = "example.com";
-// Should server replace the domain-name supplied by the client (Disabled).
-const bool FQDN_REPLACE_CLIENT_NAME = false;
-
-}
-
/// @brief file name of a server-id file
///
/// Server must store its duid in persistent storage that must not change
}
// Get the IPv6 address acquired by the client.
IOAddress addr = iaaddr->getAddress();
- std::string hostname = addr.toText();
- // Colons may not be ok for FQDNs so let's replace them with hyphens.
- std::replace(hostname.begin(), hostname.end(), ':', '-');
- std::ostringstream stream;
- // The final FQDN consists of the partial domain name and the suffix.
- // For example, if the acquired address is 2001:db8:1::2, the generated
- // FQDN may be:
- // host-2001-db8:1--2.example.com.
- // where prefix 'host' should be configurable. The domain name suffix
- // should also be configurable.
- stream << "host-" << hostname << "." << FQDN_PARTIAL_SUFFIX << ".";
+ std::string generated_name =
+ CfgMgr::instance().getD2ClientMgr().generateFqdn(addr);
try {
// The lease has been acquired but the FQDN for this lease hasn't
// been updated in the lease database. We now have new FQDN
Lease6Ptr lease =
LeaseMgrFactory::instance().getLease6(Lease::TYPE_NA, addr);
if (lease) {
- lease->hostname_ = stream.str();
+ lease->hostname_ = generated_name;
LeaseMgrFactory::instance().updateLease6(lease);
} else {
" client");
}
}
-
// Set the generated FQDN in the Client FQDN option.
- fqdn->setDomainName(stream.str(), Option6ClientFqdn::FULL);
+ fqdn->setDomainName(generated_name, Option6ClientFqdn::FULL);
} catch (const Exception& ex) {
LOG_ERROR(dhcp6_logger, DHCP6_NAME_GEN_UPDATE_FAIL)
- .arg(hostname)
+ .arg(addr.toText())
.arg(ex.what());
}
}
/// objects and store them in the internal queue. Requests created by this
/// function are only adding or updating DNS records. In order to generate
/// requests for DNS records removal, use @c createRemovalNameChangeRequest.
+ /// If ddns updates are disabled, this method returns immediately.
///
/// @todo Add support for multiple IAADDR options in the IA_NA.
///
/// Note that this function will not remove the entries which server hadn't
/// added. This is the case, when client performs forward DNS update on its
/// own.
+ /// If ddns updates are disabled, this method returns immediately.
///
/// @param lease A lease for which the the removal of corresponding DNS
/// records will be performed.
NakedDhcpv6Srv srv(0);
testProcessMessage(DHCPV6_REQUEST, "",
- "host-2001-db8-1-1--dead-beef.example.com.",
+ "myhost-2001-db8-1-1--dead-beef.example.com.",
srv, false);
ASSERT_EQ(1, srv.name_change_reqs_.size());
verifyNameChangeRequest(srv, isc::dhcp_ddns::CHG_ADD, true, true,
"2001:db8:1:1::dead:beef",
- "0002018D6874B105A5C92DBBD6E4F6C80A93161"
- "BC03996F0CD0EB75800DEF997C29961",
+ "000201C905E54BE12DE6AF92ADE72752B9F362"
+ "13B5A8BC9D217548CD739B4CF31AFB1B",
0, 4000);
}