diff options
author | Thomas Markwalder <tmark@isc.org> | 2024-07-23 15:23:20 +0200 |
---|---|---|
committer | Thomas Markwalder <tmark@isc.org> | 2024-07-23 16:21:12 +0200 |
commit | 2be7010d22eefadb311803a1153ca091229ebabc (patch) | |
tree | 39b990fc7a2162bf577607c1b91aeca5885e5ecb | |
parent | [#3469] Added missing preferred checks (diff) | |
download | kea-2be7010d22eefadb311803a1153ca091229ebabc.tar.xz kea-2be7010d22eefadb311803a1153ca091229ebabc.zip |
[#3469] Corrected MySQL binding offsets for class update
/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc
MySqlConfigBackendDHCPv6Impl::createUpdateClientClass6()
- corrected binding offsets
/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc
GenericConfigBackendDHCPv6Test::createUpdateClientClass6OptionsTest()
- added lifetime member checks
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc | 2 | ||||
-rw-r--r-- | src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc | 16 |
3 files changed, 24 insertions, 1 deletions
@@ -1,3 +1,10 @@ +2267. [bug] tmark + Corrected an issue in MySQL config back end that + causes preferred life time values to be overwritten + when updating client classes via remote-set-class6. + command. + (Gitlab #3469) + 2266. [bug] fdupont Improved the code handling multiple instances of the same v4 option according to RFC 3396. diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc index 76c295b4f0..fa3b457fff 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc @@ -3118,7 +3118,7 @@ public: // If position is not specified, leave the class at the same position. // Remove the binding which specifies the position and use different // query. - in_bindings.erase(in_bindings.begin() + 10, in_bindings.begin() + 11); + in_bindings.erase(in_bindings.begin() + 7, in_bindings.begin() + 8); conn_.updateDeleteQuery(MySqlConfigBackendDHCPv6Impl::UPDATE_CLIENT_CLASS6_SAME_POSITION, in_bindings); } else { diff --git a/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc b/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc index ba8858dd1f..216697ba43 100644 --- a/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc +++ b/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc @@ -4450,6 +4450,14 @@ GenericConfigBackendDHCPv6Test::createUpdateClientClass6OptionsTest() { ASSERT_NO_THROW_LOG(client_class = cbptr_->getClientClass6(ServerSelector::ALL(), class1->getName())); ASSERT_TRUE(client_class); + // Verify lifetime values. + EXPECT_EQ(30, client_class->getValid().getMin()); + EXPECT_EQ(60, client_class->getValid().get()); + EXPECT_EQ(90, client_class->getValid().getMax()); + EXPECT_EQ(25, client_class->getPreferred().getMin()); + EXPECT_EQ(55, client_class->getPreferred().get()); + EXPECT_EQ(85, client_class->getPreferred().getMax()); + // Validate options belonging to the class. ASSERT_TRUE(client_class->getCfgOption()); OptionDescriptor returned_opt_new_posix_timezone = @@ -4495,6 +4503,14 @@ GenericConfigBackendDHCPv6Test::createUpdateClientClass6OptionsTest() { ASSERT_NO_THROW_LOG(client_class = cbptr_->getClientClass6(ServerSelector::ALL(), class1->getName())); ASSERT_TRUE(client_class); + // Re-check lifetime values. This ensure bindings line up. + EXPECT_EQ(30, client_class->getValid().getMin()); + EXPECT_EQ(60, client_class->getValid().get()); + EXPECT_EQ(90, client_class->getValid().getMax()); + EXPECT_EQ(25, client_class->getPreferred().getMin()); + EXPECT_EQ(55, client_class->getPreferred().get()); + EXPECT_EQ(85, client_class->getPreferred().getMax()); + // Ensure that the first option definition is gone. ASSERT_TRUE(client_class->getCfgOptionDef()); returned_def_foo = client_class->getCfgOptionDef()->get(test_option_defs_[0]->getOptionSpaceName(), |