From: Francis Dupont Date: Tue, 21 Mar 2023 13:42:38 +0000 (+0100) Subject: [#2785] Added ChangeLog entry and UT X-Git-Tag: Kea-2.3.6~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00a9c73ec72ddc54713eacbc6610754287b69aea;p=thirdparty%2Fkea.git [#2785] Added ChangeLog entry and UT --- diff --git a/ChangeLog b/ChangeLog index 63f1017e6c..7a3e334bee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2117. [func] fdupont + Added a new ignore-dhcp-server-identifier DHCPv4 compatibility + flag which when set to true (default is false) makes any query + to be accepted even when the address in the DHCP Server + Identifier option belongs to another server (standard behavior + is to drop such queries). + (Gitlab #2785) + 2116. [func] piotrek Added support of Secure Zero Touch Provisioning options as per RFC8572. Kea can now handle DHCPv4 Option code #143 and DHCPv6 diff --git a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc index c4b7064a86..56e4209b5b 100644 --- a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc +++ b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc @@ -2466,6 +2466,9 @@ TEST_F(Dhcpv4SrvTest, buildCfgOptionsList) { // identifiers used by a server is accepted, // - a message with a server identifier which doesn't match any server // identifier used by a server, is not accepted. +// - a message with a server identifier which doesn't match any server +// identifier used by a server is accepted when the DHCP Server Identifier +// option is configured to be ignored. TEST_F(Dhcpv4SrvTest, acceptServerId) { configureServerIdentifier(); IfaceMgrTestConfig test_config(true); @@ -2491,6 +2494,15 @@ TEST_F(Dhcpv4SrvTest, acceptServerId) { pkt->addOption(other_serverid); EXPECT_FALSE(srv.acceptServerId(pkt)); + // Configure the DHCP Server Identifier to be ignored. + ASSERT_FALSE(CfgMgr::instance().getCurrentCfg()->getIgnoreServerIdentifier()); + CfgMgr::instance().getCurrentCfg()->setIgnoreServerIdentifier(true); + EXPECT_TRUE(srv.acceptServerId(pkt)); + + // Restore the ignore-dhcp-server-identifier compatibility flag. + CfgMgr::instance().getCurrentCfg()->setIgnoreServerIdentifier(false); + EXPECT_FALSE(srv.acceptServerId(pkt)); + // Remove the server identifier. ASSERT_NO_THROW(pkt->delOption(DHO_DHCP_SERVER_IDENTIFIER));