]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1235] Addressed review comments
authorThomas Markwalder <tmark@isc.org>
Tue, 16 Jun 2020 14:37:49 +0000 (10:37 -0400)
committerThomas Markwalder <tmark@isc.org>
Tue, 16 Jun 2020 16:06:59 +0000 (12:06 -0400)
src/lib/dhcp/libdhcp++.cc
src/lib/dhcp/std_option_defs.h
    Removed LQ_QUERY_OPTION_SPACE, using DHCP6_OPTION_SPACE instead

src/lib/dhcp/tests/libdhcp++_unittest.cc
    Updated unit test

src/lib/dhcpsrv/cfg_duid.*
    CfgDUID::create() - reset the internal DUID value

src/lib/dhcp/libdhcp++.cc
src/lib/dhcp/std_option_defs.h
src/lib/dhcp/tests/libdhcp++_unittest.cc
src/lib/dhcpsrv/cfg_duid.cc
src/lib/dhcpsrv/cfg_duid.h

index 994e7a638af6030f6ce1c4d30d480642643800e5..6a6ba1344bc2cd308e6ac38f6a120d35b05f3f28 100644 (file)
@@ -50,7 +50,6 @@ const OptionDefParamsEncapsulation OPTION_DEF_PARAMS[] = {
     { LW_V6_OPTION_DEFINITIONS,             LW_V6_OPTION_DEFINITIONS_SIZE,           LW_V6_OPTION_SPACE          },
     { V4V6_RULE_OPTION_DEFINITIONS,         V4V6_RULE_OPTION_DEFINITIONS_SIZE,       V4V6_RULE_OPTION_SPACE      },
     { V4V6_BIND_OPTION_DEFINITIONS,         V4V6_BIND_OPTION_DEFINITIONS_SIZE,       V4V6_BIND_OPTION_SPACE      },
-    { LQ_QUERY_OPTION_DEFINITIONS,          LQ_QUERY_OPTION_DEFINITIONS_SIZE,        LQ_QUERY_OPTION_SPACE       },
     { LAST_RESORT_V4_OPTION_DEFINITIONS,    LAST_RESORT_V4_OPTION_DEFINITIONS_SIZE,  LAST_RESORT_V4_OPTION_SPACE },
     { NULL,                                 0,                                       ""                          }
 };
index a08434a68fcd63a09dc3fd05c5e61d60a4e0f118..9c08a1d215694fa9ff22c6cfcf80e3019df2f909 100644 (file)
@@ -27,7 +27,6 @@
 #define DHCP_AGENT_OPTION_SPACE          "dhcp-agent-options-space"
 #define VENDOR_OPTION_SPACE              "vendor-opts-space"
 #define VENDOR_ENCAPSULATED_OPTION_SPACE "vendor-encapsulated-options-space"
-#define LQ_QUERY_OPTION_SPACE            "lq-query-option-space"
 
 // NOTE:
 // When adding a new space, make sure you also update
@@ -431,7 +430,7 @@ const OptionDefParams STANDARD_V6_OPTION_DEFINITIONS[] = {
       NO_RECORD_DEF, "" },
     { "ero", D6O_ERO, OPT_UINT16_TYPE, true, NO_RECORD_DEF, "" },
     { "lq-query", D6O_LQ_QUERY, OPT_RECORD_TYPE, false,
-      RECORD_DEF(LQ_QUERY_RECORDS), LQ_QUERY_OPTION_SPACE },
+      RECORD_DEF(LQ_QUERY_RECORDS), DHCP6_OPTION_SPACE },
     { "client-data", D6O_CLIENT_DATA, OPT_EMPTY_TYPE, false, NO_RECORD_DEF,
       DHCP6_OPTION_SPACE },
     { "clt-time", D6O_CLT_TIME, OPT_UINT32_TYPE, false, NO_RECORD_DEF, "" },
@@ -565,18 +564,6 @@ const int V4V6_BIND_OPTION_DEFINITIONS_SIZE =
     sizeof(V4V6_BIND_OPTION_DEFINITIONS) /
     sizeof(V4V6_BIND_OPTION_DEFINITIONS[0]);
 
-/// @brief LQ_QUERY suboption definitions (v6)
-const OptionDefParams LQ_QUERY_OPTION_DEFINITIONS[] = {
-    { "clientid", D6O_CLIENTID, OPT_BINARY_TYPE, false, NO_RECORD_DEF, ""},
-    { "iaaddr", D6O_IAADDR, OPT_RECORD_TYPE, false, RECORD_DEF(IAADDR_RECORDS), ""},
-    { "oro", D6O_ORO, OPT_UINT16_TYPE, true, NO_RECORD_DEF, "" }
-};
-
-const int LQ_QUERY_OPTION_DEFINITIONS_SIZE =
-    sizeof(LQ_QUERY_OPTION_DEFINITIONS) /
-    sizeof(LQ_QUERY_OPTION_DEFINITIONS[0]);
-
-
 }  // namespace
 
 }  // namespace dhcp
index a803536d8c20958cfa3953c79914c730c195e902..3e2e143f9c66c780f85b495c7065fc877cf64e3c 100644 (file)
@@ -1925,7 +1925,7 @@ TEST_F(LibDhcpTest, stdOptionDefs6) {
                                     typeid(OptionIntArray<uint16_t>));
 
     LibDhcpTest::testStdOptionDefs6(D6O_LQ_QUERY, begin, end,
-                                    typeid(OptionCustom), LQ_QUERY_OPTION_SPACE);
+                                    typeid(OptionCustom), DHCP6_OPTION_SPACE);
 
     LibDhcpTest::testStdOptionDefs6(D6O_CLIENT_DATA, begin, end,
                                     typeid(OptionCustom), DHCP6_OPTION_SPACE);
index 90b344f457a7dbfb1c68b153acc795b643cb1083..fe17f208cbfc5082fbfdf5d1196631faad19019e 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2015,2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -53,6 +53,9 @@ CfgDUID::setIdentifier(const std::string& identifier_as_hex) {
 
 DuidPtr
 CfgDUID::create(const std::string& duid_file_path) {
+    // Forget the current DUID.
+    current_duid_.reset();
+
     // Use DUID factory to create a DUID instance.
     DUIDFactory factory(persist() ? duid_file_path : "");
 
@@ -72,8 +75,10 @@ CfgDUID::create(const std::string& duid_file_path) {
                   << " to create a new DUID");
     }
 
-    // Return generated DUID.
+    // Save the newly created DUID.
     current_duid_ = factory.get();
+
+    // Return generated DUID.
     return (current_duid_);
 }
 
index 91fea0cc8a7e6d0a64b4779d3dafc2c6e01c85a8..6897ee65a4e39b379a2048de42fe023c140c0aac 100644 (file)
@@ -112,6 +112,9 @@ public:
 
     /// @brief Creates instance of a DUID from the current configuration.
     ///
+    /// The newly created DUID is retained internally to make it accessible
+    /// anywhere.
+    ///
     /// @param duid_file_path Absolute path to a DUID file.
     /// @return Pointer to an instance of new DUID.
     DuidPtr create(const std::string& duid_file_path);