Skip to content

Commit 2be7010

Browse files
committed
[#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
1 parent 5c8d25c commit 2be7010

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2267. [bug] tmark
2+
Corrected an issue in MySQL config back end that
3+
causes preferred life time values to be overwritten
4+
when updating client classes via remote-set-class6.
5+
command.
6+
(Gitlab #3469)
7+
18
2266. [bug] fdupont
29
Improved the code handling multiple instances of
310
the same v4 option according to RFC 3396.

src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3118,7 +3118,7 @@ class MySqlConfigBackendDHCPv6Impl : public MySqlConfigBackendImpl {
31183118
// If position is not specified, leave the class at the same position.
31193119
// Remove the binding which specifies the position and use different
31203120
// query.
3121-
in_bindings.erase(in_bindings.begin() + 10, in_bindings.begin() + 11);
3121+
in_bindings.erase(in_bindings.begin() + 7, in_bindings.begin() + 8);
31223122
conn_.updateDeleteQuery(MySqlConfigBackendDHCPv6Impl::UPDATE_CLIENT_CLASS6_SAME_POSITION,
31233123
in_bindings);
31243124
} else {

src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4450,6 +4450,14 @@ GenericConfigBackendDHCPv6Test::createUpdateClientClass6OptionsTest() {
44504450
ASSERT_NO_THROW_LOG(client_class = cbptr_->getClientClass6(ServerSelector::ALL(), class1->getName()));
44514451
ASSERT_TRUE(client_class);
44524452

4453+
// Verify lifetime values.
4454+
EXPECT_EQ(30, client_class->getValid().getMin());
4455+
EXPECT_EQ(60, client_class->getValid().get());
4456+
EXPECT_EQ(90, client_class->getValid().getMax());
4457+
EXPECT_EQ(25, client_class->getPreferred().getMin());
4458+
EXPECT_EQ(55, client_class->getPreferred().get());
4459+
EXPECT_EQ(85, client_class->getPreferred().getMax());
4460+
44534461
// Validate options belonging to the class.
44544462
ASSERT_TRUE(client_class->getCfgOption());
44554463
OptionDescriptor returned_opt_new_posix_timezone =
@@ -4495,6 +4503,14 @@ GenericConfigBackendDHCPv6Test::createUpdateClientClass6OptionsTest() {
44954503
ASSERT_NO_THROW_LOG(client_class = cbptr_->getClientClass6(ServerSelector::ALL(), class1->getName()));
44964504
ASSERT_TRUE(client_class);
44974505

4506+
// Re-check lifetime values. This ensure bindings line up.
4507+
EXPECT_EQ(30, client_class->getValid().getMin());
4508+
EXPECT_EQ(60, client_class->getValid().get());
4509+
EXPECT_EQ(90, client_class->getValid().getMax());
4510+
EXPECT_EQ(25, client_class->getPreferred().getMin());
4511+
EXPECT_EQ(55, client_class->getPreferred().get());
4512+
EXPECT_EQ(85, client_class->getPreferred().getMax());
4513+
44984514
// Ensure that the first option definition is gone.
44994515
ASSERT_TRUE(client_class->getCfgOptionDef());
45004516
returned_def_foo = client_class->getCfgOptionDef()->get(test_option_defs_[0]->getOptionSpaceName(),

0 commit comments

Comments
 (0)