BIND 10 trac3034, updated. 4ae21182c9657a733b34f6da9371d8962928e5a8 [3034] Replaced constant with CfgMgr::ddnsEnabled() in Dhcpv6Srv
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Feb 17 16:56:46 UTC 2014
The branch, trac3034 has been updated
via 4ae21182c9657a733b34f6da9371d8962928e5a8 (commit)
from a246289c3300f0c672e4951f18788481955122fc (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 4ae21182c9657a733b34f6da9371d8962928e5a8
Author: Thomas Markwalder <tmark at isc.org>
Date: Mon Feb 17 11:55:19 2014 -0500
[3034] Replaced constant with CfgMgr::ddnsEnabled() in Dhcpv6Srv
Dhcpv6Srv now uses method in CfgMgr to test whether or not ddns updates
are enabled. Add unit tests to verify NCRs are or are not created
accordingly.
-----------------------------------------------------------------------
Summary of changes:
src/bin/dhcp6/dhcp6_srv.cc | 6 ++---
src/bin/dhcp6/tests/fqdn_unittest.cc | 49 ++++++++++++++++++++++++++++++++++
2 files changed, 51 insertions(+), 4 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc
index 256676d..5c562e0 100644
--- a/src/bin/dhcp6/dhcp6_srv.cc
+++ b/src/bin/dhcp6/dhcp6_srv.cc
@@ -104,8 +104,6 @@ namespace {
// DHCPv6 Client FQDN Option sent by a client. They will be removed
// when DDNS parameters for DHCPv6 are implemented with the ticket #3034.
-// Globally enable updates (Enabled).
-const bool FQDN_ENABLE_UPDATE = true;
// 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).
@@ -1030,7 +1028,7 @@ Dhcpv6Srv::processClientFqdn(const Pkt6Ptr& question, const Pkt6Ptr& answer) {
void
Dhcpv6Srv::createNameChangeRequests(const Pkt6Ptr& answer) {
// Don't create NameChangeRequests if DNS updates are disabled.
- if (!FQDN_ENABLE_UPDATE) {
+ if (!CfgMgr::instance().ddnsEnabled()) {
return;
}
@@ -1117,7 +1115,7 @@ Dhcpv6Srv::createNameChangeRequests(const Pkt6Ptr& answer) {
void
Dhcpv6Srv::createRemovalNameChangeRequest(const Lease6Ptr& lease) {
// Don't create NameChangeRequests if DNS updates are disabled.
- if (!FQDN_ENABLE_UPDATE) {
+ if (!CfgMgr::instance().ddnsEnabled()) {
return;
}
diff --git a/src/bin/dhcp6/tests/fqdn_unittest.cc b/src/bin/dhcp6/tests/fqdn_unittest.cc
index bab0e18..0fd5c49 100644
--- a/src/bin/dhcp6/tests/fqdn_unittest.cc
+++ b/src/bin/dhcp6/tests/fqdn_unittest.cc
@@ -588,6 +588,34 @@ TEST_F(FqdnDhcpv6SrvTest, createNameChangeRequests) {
}
+// Checks that NameChangeRequests to add entries are not
+// created when ddns updates are disabled.
+TEST_F(FqdnDhcpv6SrvTest, noAddRequestsWhenDisabled) {
+ NakedDhcpv6Srv srv(0);
+
+ // Disable DDNS udpates.
+ disableD2();
+
+ // Create Reply message with Client Id and Server id.
+ Pkt6Ptr answer = generateMessageWithIds(DHCPV6_REPLY, srv);
+
+ // Create three IAs, each having different address.
+ addIA(1234, IOAddress("2001:db8:1::1"), answer);
+
+ // Use domain name in upper case. It should be converted to lower-case
+ // before DHCID is calculated. So, we should get the same result as if
+ // we typed domain name in lower-case.
+ Option6ClientFqdnPtr fqdn = createClientFqdn(Option6ClientFqdn::FLAG_S,
+ "MYHOST.EXAMPLE.COM",
+ Option6ClientFqdn::FULL);
+ answer->addOption(fqdn);
+
+ // Create NameChangeRequest for the first allocated address.
+ ASSERT_NO_THROW(srv.createNameChangeRequests(answer));
+ ASSERT_TRUE(srv.name_change_reqs_.empty());
+}
+
+
// Test creation of the NameChangeRequest to remove both forward and reverse
// mapping for the given lease.
TEST_F(FqdnDhcpv6SrvTest, createRemovalNameChangeRequestFwdRev) {
@@ -612,6 +640,27 @@ TEST_F(FqdnDhcpv6SrvTest, createRemovalNameChangeRequestFwdRev) {
}
+// Checks that NameChangeRequests to remove entries are not created
+// when ddns updates are disabled.
+TEST_F(FqdnDhcpv6SrvTest, noRemovalsWhenDisabled) {
+ NakedDhcpv6Srv srv(0);
+
+ // Disable DDNS updates.
+ disableD2();
+
+ lease_->fqdn_fwd_ = true;
+ lease_->fqdn_rev_ = true;
+ // Part of the domain name is in upper case, to test that it gets converted
+ // to lower case before DHCID is computed. So, we should get the same DHCID
+ // as if we typed domain-name in lower case.
+ lease_->hostname_ = "MYHOST.example.com.";
+
+ ASSERT_NO_THROW(srv.createRemovalNameChangeRequest(lease_));
+
+ ASSERT_TRUE(srv.name_change_reqs_.empty());
+}
+
+
// Test creation of the NameChangeRequest to remove reverse mapping for the
// given lease.
TEST_F(FqdnDhcpv6SrvTest, createRemovalNameChangeRequestRev) {
More information about the bind10-changes
mailing list