From: Thomas Markwalder Date: Fri, 12 Jun 2020 15:42:00 +0000 (-0400) Subject: [#1235] Updated v6 option defintions, made current server_id accessible X-Git-Tag: Kea-1.7.9~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b58b3fa794107afc7ba793a3c6b5ba88600b1b2b;p=thirdparty%2Fkea.git [#1235] Updated v6 option defintions, made current server_id accessible src/lib/dhcp/libdhcp++.cc Added LQ_QUERY_OPTION_SPACE to encapuslate options conveyed with D6O_LQ_QUERY options src/lib/dhcp/std_option_defs.h Revamped defintions D6O_LQ_QUERY adn D6O_CLIENT_DATA src/lib/dhcp/tests/libdhcp++_unittest.cc Updated unit tests src/lib/dhcp/tests/pkt6_unittest.cc TEST_F(Pkt6Test, lqQueryOption) TEST_F(Pkt6Test, clientDataOption) TEST_F(Pkt6Test, relayDataOption) - new tests src/lib/dhcpsrv/cfg_duid.* CfgDUID::create() - modified to retain the created DUID so it can be retrieved in places other than than Dhcp6Srv instances, such as hook callouts. src/lib/dhcpsrv/tests/cfg_duid_unittest.cc Updated unit tests. --- diff --git a/src/lib/dhcp/libdhcp++.cc b/src/lib/dhcp/libdhcp++.cc index 6a6ba1344b..994e7a638a 100644 --- a/src/lib/dhcp/libdhcp++.cc +++ b/src/lib/dhcp/libdhcp++.cc @@ -50,6 +50,7 @@ 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, "" } }; diff --git a/src/lib/dhcp/std_option_defs.h b/src/lib/dhcp/std_option_defs.h index 9c08a1d215..8142140dd0 100644 --- a/src/lib/dhcp/std_option_defs.h +++ b/src/lib/dhcp/std_option_defs.h @@ -27,6 +27,7 @@ #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 @@ -564,6 +565,18 @@ 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 diff --git a/src/lib/dhcpsrv/tests/cfg_duid_unittest.cc b/src/lib/dhcpsrv/tests/cfg_duid_unittest.cc index 10da5b9b4f..e862ab7f40 100644 --- a/src/lib/dhcpsrv/tests/cfg_duid_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfg_duid_unittest.cc @@ -220,7 +220,11 @@ TEST_F(CfgDUIDTest, createEN) { // Verify that the DUID file has been created. EXPECT_TRUE(fileExists(absolutePath(DUID_FILE_NAME))); +<<<<<<< HEAD // Verify getCurrentDuid() returns the value created. +======= + // Verifiy getCurrentDuid() returns the value created. +>>>>>>> [#1235] Updated v6 option defintions, made current server_id accessible DuidPtr current_duid = cfg.getCurrentDuid(); ASSERT_TRUE(current_duid); EXPECT_EQ(*current_duid, *duid); @@ -245,7 +249,11 @@ TEST_F(CfgDUIDTest, createLL) { // Verify that the DUID file has been created. EXPECT_TRUE(fileExists(absolutePath(DUID_FILE_NAME))); +<<<<<<< HEAD // Verify getCurrentDuid() returns the value created. +======= + // Verifiy getCurrentDuid() returns the value created. +>>>>>>> [#1235] Updated v6 option defintions, made current server_id accessible DuidPtr current_duid = cfg.getCurrentDuid(); ASSERT_TRUE(current_duid); EXPECT_EQ(*current_duid, *duid); @@ -271,7 +279,11 @@ TEST_F(CfgDUIDTest, createDisableWrite) { // DUID persistence is disabled so there should be no DUID file. EXPECT_FALSE(fileExists(absolutePath(DUID_FILE_NAME))); +<<<<<<< HEAD // Verify getCurrentDuid() returns the value created. +======= + // Verifiy getCurrentDuid() returns the value created. +>>>>>>> [#1235] Updated v6 option defintions, made current server_id accessible DuidPtr current_duid = cfg.getCurrentDuid(); ASSERT_TRUE(current_duid); EXPECT_EQ(*current_duid, *duid);