]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3509] backported #3469 to Kea-2.6.1
authorRazvan Becheriu <razvan@isc.org>
Wed, 24 Jul 2024 08:30:30 +0000 (11:30 +0300)
committerRazvan Becheriu <razvan@isc.org>
Wed, 24 Jul 2024 10:41:31 +0000 (13:41 +0300)
ChangeLog
src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc
src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc
src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc

index e101ca3f3927189aaec7d9f652f20bebba56fa55..d42d6c9aa0fa04ca1edabb757b458a5cca491883 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2252.  [bug]           tmark, razvan
+       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 #3509, #3469)
+
 2251.  [build]         razvan
        The library version numbers have been bumped up for the Kea 2.6.1
        stable release.
@@ -17,6 +24,7 @@
        sometimes not returned when they were specified at the subnet,
        shared network or client class level.
        (Gitlab #3485)
+
 2248.  [bug]           razvan
        Fixed a file descriptor leak in the High Availability hook
        library.
index 76c295b4f02950c1ff90bdf37e06214caedb44ab..fa3b457fff337397ae5c2e4652246cc7585bd63e 100644 (file)
@@ -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 {
index 56e404a54a5ba0eb997e3e496c90e23853130eb6..e01d21fa83a58ecd9faf8636b7aa56f3cc2b6a4b 100644 (file)
@@ -4187,6 +4187,11 @@ GenericConfigBackendDHCPv4Test::createUpdateClientClass4OptionsTest() {
     ASSERT_NO_THROW_LOG(client_class = cbptr_->getClientClass4(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());
+
     // Validate options belonging to the class.
     ASSERT_TRUE(client_class->getCfgOption());
     OptionDescriptor returned_opt_boot_file_name =
@@ -4232,6 +4237,11 @@ GenericConfigBackendDHCPv4Test::createUpdateClientClass4OptionsTest() {
     ASSERT_NO_THROW_LOG(client_class = cbptr_->getClientClass4(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());
+
     // 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(),
index ea453ac525b15a542d870a4ad4aa605d11d9aa9d..e42c0182ff6028a5c06457bbb21b0a3b9246dcc8 100644 (file)
@@ -4271,6 +4271,9 @@ GenericConfigBackendDHCPv6Test::getClientClass6Test() {
     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 this class.
     ASSERT_TRUE(client_class->getCfgOption());
@@ -4338,6 +4341,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 =
@@ -4383,6 +4394,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(),