BIND 10 trac3282, updated. 4289cec8c39d8ed8411c1b2718c5d8f63aa3f122 [3282] Addes support for full parsing of disable dhcp-ddns entry

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Jan 20 15:32:13 UTC 2014


The branch, trac3282 has been updated
       via  4289cec8c39d8ed8411c1b2718c5d8f63aa3f122 (commit)
      from  8534089c1e8a7e3c48a49bf08784ebf05d11b3a1 (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 4289cec8c39d8ed8411c1b2718c5d8f63aa3f122
Author: Thomas Markwalder <tmark at isc.org>
Date:   Mon Jan 20 10:28:59 2014 -0500

    [3282] Addes support for full parsing of disable dhcp-ddns entry
    
    D2CLientConfigParser now supports parsing all parameters even if
    enable-updates is false.  This allows values like generated-prefix
    and qualifying-suffix to be used even if udpates are turned off.
    The parser still supports an abbreviated dhcp-ddns entry that has only
    enable-updates defined as false.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/dhcpsrv/dhcp_parsers.cc                |    9 +++++----
 src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc |   10 +++++-----
 2 files changed, 10 insertions(+), 9 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dhcpsrv/dhcp_parsers.cc b/src/lib/dhcpsrv/dhcp_parsers.cc
index c647954..3525185 100644
--- a/src/lib/dhcpsrv/dhcp_parsers.cc
+++ b/src/lib/dhcpsrv/dhcp_parsers.cc
@@ -1182,10 +1182,11 @@ D2ClientConfigParser::build(isc::data::ConstElementPtr client_config) {
     }
 
     bool enable_updates = boolean_values_->getParam("enable-updates");
-    if (!enable_updates) {
-        // If it's not enabled, don't bother validating the rest.  This
-        // allows for an abbreviated config entry that only contains
-        // the flag.  The default constructor creates a disabled instance.
+    if (!enable_updates && (client_config->mapValue().size() == 1)) {
+        // If enable-updates is the only parameter and it is false then
+        // we're done.  This allows for an abbreviated configuration entry
+        // that only contains that flag.  Use the default D2ClientConfig
+        // constructor to a create a disabled instance.
         local_client_config_.reset(new D2ClientConfig());
         return;
     }
diff --git a/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc b/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
index 2e6adb9..b615cb6 100644
--- a/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
+++ b/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
@@ -755,12 +755,12 @@ TEST_F(ParseConfigTest, validD2Config) {
     EXPECT_EQ("test.suffix.", d2_client_config->getQualifyingSuffix());
 
     // Another valid Configuration string.
-    // This one has IPV6 server ip, control flags false,
+    // This one is disabled, has IPV6 server ip, control flags false,
     // empty prefix/suffix
     std::string config_str2 =
         "{ \"dhcp-ddns\" :"
         "    {"
-        "     \"enable-updates\" : true, "
+        "     \"enable-updates\" : false, "
         "     \"server-ip\" : \"2001:db8::\", "
         "     \"server-port\" : 43567, "
         "     \"ncr-protocol\" : \"UDP\", "
@@ -779,13 +779,13 @@ TEST_F(ParseConfigTest, validD2Config) {
     rcode = parseConfiguration(config_str2);
     ASSERT_TRUE(rcode == 0) << error_text_;
 
-    // Verify that DHCP-DDNS is enabled and we can fetch the configuration.
-    EXPECT_TRUE(CfgMgr::instance().ddnsEnabled());
+    // Verify that DHCP-DDNS is disabled and we can fetch the configuration.
+    EXPECT_FALSE(CfgMgr::instance().ddnsEnabled());
     ASSERT_NO_THROW(d2_client_config = CfgMgr::instance().getD2ClientConfig());
     ASSERT_TRUE(d2_client_config);
 
     // Verify that the configuration values are as expected.
-    EXPECT_TRUE(d2_client_config->getEnableUpdates());
+    EXPECT_FALSE(d2_client_config->getEnableUpdates());
     EXPECT_EQ("2001:db8::", d2_client_config->getServerIp().toText());
     EXPECT_EQ(43567, d2_client_config->getServerPort());
     EXPECT_EQ(dhcp_ddns::NCR_UDP, d2_client_config->getNcrProtocol());



More information about the bind10-changes mailing list