From: Razvan Becheriu Date: Tue, 18 Apr 2023 16:09:36 +0000 (+0300) Subject: [#2794] fixed circuit id and remote id definitions X-Git-Tag: Kea-2.3.7~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab0e84d524164125994223942cf2cee39e8c36c6;p=thirdparty%2Fkea.git [#2794] fixed circuit id and remote id definitions --- diff --git a/src/lib/dhcp/std_option_defs.h b/src/lib/dhcp/std_option_defs.h index 08f8ef751f..f2057d710b 100644 --- a/src/lib/dhcp/std_option_defs.h +++ b/src/lib/dhcp/std_option_defs.h @@ -382,9 +382,9 @@ const int STANDARD_V4_OPTION_DEFINITIONS_SIZE = /// Definitions of DHCPv4 agent options. const OptionDefParams DHCP_AGENT_OPTION_DEFINITIONS[] = { { "circuit-id", RAI_OPTION_AGENT_CIRCUIT_ID, - DHCP_AGENT_OPTION_SPACE, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" }, + DHCP_AGENT_OPTION_SPACE, OPT_BINARY_TYPE, false, NO_RECORD_DEF, "" }, { "remote-id", RAI_OPTION_REMOTE_ID, - DHCP_AGENT_OPTION_SPACE, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" }, + DHCP_AGENT_OPTION_SPACE, OPT_BINARY_TYPE, false, NO_RECORD_DEF, "" }, { "docsis-device-class", RAI_OPTION_DOCSIS_DEVICE_CLASS, DHCP_AGENT_OPTION_SPACE, OPT_UINT32_TYPE, false, NO_RECORD_DEF, "" }, { "link-selection", RAI_OPTION_LINK_SELECTION, diff --git a/src/lib/dhcp/tests/libdhcp++_unittest.cc b/src/lib/dhcp/tests/libdhcp++_unittest.cc index 9f6d722886..2c8f321f95 100644 --- a/src/lib/dhcp/tests/libdhcp++_unittest.cc +++ b/src/lib/dhcp/tests/libdhcp++_unittest.cc @@ -668,8 +668,8 @@ static uint8_t v4_opts[] = { 43, 2, // Vendor Specific Information 0xDC, 0, // VSI suboption 0x52, 0x19, // RAI - 0x01, 0x04, 0x20, 0x00, 0x00, 0x02, // Agent Circuit ID - 0x02, 0x06, 0x20, 0xE5, 0x2A, 0xB8, 0x15, 0x14, // Agent Remote ID + 0x01, 0x04, 0x20, 0x00, 0x02, 0x00, // Agent Circuit ID + 0x02, 0x06, 0x20, 0xE5, 0x2A, 0xB8, 0x15, 0x00, // Agent Remote ID 0x09, 0x09, 0x00, 0x00, 0x11, 0x8B, 0x04, // Vendor Specific Information 0x01, 0x02, 0x03, 0x00 // Vendor Specific Information continued }; @@ -1439,21 +1439,15 @@ TEST_F(LibDhcpTest, unpackOptions4) { // Check that Circuit ID option is among parsed options. OptionPtr rai_option = rai->getOption(RAI_OPTION_AGENT_CIRCUIT_ID); ASSERT_TRUE(rai_option); - boost::shared_ptr circuit_id = - boost::dynamic_pointer_cast(rai_option); - ASSERT_TRUE(circuit_id); - EXPECT_EQ(RAI_OPTION_AGENT_CIRCUIT_ID, circuit_id->getType()); - ASSERT_EQ(6, circuit_id->len()); - EXPECT_EQ(0, memcmp(&circuit_id->getData()[0], v4_opts + 46, 4)); + EXPECT_EQ(RAI_OPTION_AGENT_CIRCUIT_ID, rai_option->getType()); + ASSERT_EQ(6, rai_option->len()); + EXPECT_EQ(0, memcmp(&rai_option->getData()[0], v4_opts + 46, 4)); // Check that Remote ID option is among parsed options. rai_option = rai->getOption(RAI_OPTION_REMOTE_ID); ASSERT_TRUE(rai_option); - boost::shared_ptr remote_id = - boost::dynamic_pointer_cast(rai_option); - ASSERT_TRUE(remote_id); - EXPECT_EQ(RAI_OPTION_REMOTE_ID, remote_id->getType()); - ASSERT_EQ(8, remote_id->len()); + EXPECT_EQ(RAI_OPTION_REMOTE_ID, rai_option->getType()); + ASSERT_EQ(8, rai_option->len()); EXPECT_EQ(0, memcmp(&rai_option->getData()[0], v4_opts + 52, 6)); // Check that Vendor Specific Information option is among parsed options.