From: Marcin Siodelski Date: Thu, 25 Apr 2024 11:48:51 +0000 (+0200) Subject: [#3344] Fix origin type in notify cmd X-Git-Tag: Kea-2.5.8~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9f61f70619a47295193010f6189001d5d053327;p=thirdparty%2Fkea.git [#3344] Fix origin type in notify cmd --- diff --git a/src/hooks/dhcp/high_availability/command_creator.cc b/src/hooks/dhcp/high_availability/command_creator.cc index 6f73764141..f3b572090a 100644 --- a/src/hooks/dhcp/high_availability/command_creator.cc +++ b/src/hooks/dhcp/high_availability/command_creator.cc @@ -267,8 +267,8 @@ CommandCreator::createSyncCompleteNotify(const unsigned int origin_id, auto args = Element::createMap(); args->set("server-name", Element::create(server_name)); args->set("origin-id", Element::create(origin_id)); - // Add for backward compatibility with Kea 2.4.0 and earlier. - args->set("origin", Element::create("ha-partner")); + // Add for backward compatibility with Kea 2.5.5. + args->set("origin", Element::create(origin_id)); auto command = config::createCommand("ha-sync-complete-notify", args); insertService(command, server_type); return (command); diff --git a/src/hooks/dhcp/high_availability/tests/command_creator_unittest.cc b/src/hooks/dhcp/high_availability/tests/command_creator_unittest.cc index 99f935fc4b..084bb19166 100644 --- a/src/hooks/dhcp/high_availability/tests/command_creator_unittest.cc +++ b/src/hooks/dhcp/high_availability/tests/command_creator_unittest.cc @@ -564,6 +564,10 @@ TEST(CommandCreatorTest, createSyncCompleteNotify4) { ASSERT_TRUE(origin_id); EXPECT_EQ(Element::integer, origin_id->getType()); EXPECT_EQ(1, origin_id->intValue()); + auto origin = arguments->get("origin"); + ASSERT_TRUE(origin); + EXPECT_EQ(Element::integer, origin->getType()); + EXPECT_EQ(1, origin->intValue()); } // This test verifies that the ha-sync-complete-notify command sent to a @@ -580,6 +584,10 @@ TEST(CommandCreatorTest, createSyncCompleteNotify6) { ASSERT_TRUE(origin_id); EXPECT_EQ(Element::integer, origin_id->getType()); EXPECT_EQ(1, origin_id->intValue()); + auto origin = arguments->get("origin"); + ASSERT_TRUE(origin); + EXPECT_EQ(Element::integer, origin->getType()); + EXPECT_EQ(1, origin->intValue()); } }