From: Francis Dupont Date: Mon, 21 Nov 2022 14:31:05 +0000 (+0100) Subject: [#2643] Addressed comments X-Git-Tag: Kea-2.3.3~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0686d410bfbb3f0a44489a7c2af58e7beed4c01d;p=thirdparty%2Fkea.git [#2643] Addressed comments --- diff --git a/src/lib/dhcpsrv/cfg_subnets4.h b/src/lib/dhcpsrv/cfg_subnets4.h index 1305b6cb9e..d1d3c32184 100644 --- a/src/lib/dhcpsrv/cfg_subnets4.h +++ b/src/lib/dhcpsrv/cfg_subnets4.h @@ -99,7 +99,7 @@ public: /// not be modified after the call to @c merge because it may affect the /// merged configuration. /// - /// @param cfg_def set of of user-defined option definitions to use + /// @param cfg_def set of user-defined option definitions to use /// when creating option instances. /// @param networks collection of shared networks that to which assignments /// should be added. In other words, the list of shared networks that belong diff --git a/src/lib/dhcpsrv/cfg_subnets6.h b/src/lib/dhcpsrv/cfg_subnets6.h index a8b59e2327..54f3774460 100644 --- a/src/lib/dhcpsrv/cfg_subnets6.h +++ b/src/lib/dhcpsrv/cfg_subnets6.h @@ -100,7 +100,7 @@ public: /// not be modified after the call to @c merge because it may affect the /// merged configuration. /// - /// @param cfg_def set of of user-defined option definitions to use + /// @param cfg_def set of user-defined option definitions to use /// when creating option instances. /// @param networks collection of shared networks that to which assignments /// should be added. In other words, the list of shared networks that belong diff --git a/src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc b/src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc index bba6f2e125..f2bafc35e2 100644 --- a/src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc @@ -2088,7 +2088,9 @@ TEST(CfgSubnets4Test, outOfRangeHost) { TEST(CfgSubnets4Test, getLinks) { CfgSubnets4 cfg; - // Create 3 subnets. + // Create 4 subnets. + Subnet4Ptr subnet0(new Subnet4(IOAddress("0.0.0.0"), + 24, 1, 2, 3, SubnetID(111))); Subnet4Ptr subnet1(new Subnet4(IOAddress("192.0.1.0"), 26, 1, 2, 3, SubnetID(1))); Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.0"), @@ -2097,6 +2099,7 @@ TEST(CfgSubnets4Test, getLinks) { 26, 1, 2, 3, SubnetID(3))); // Add all subnets to the configuration. + ASSERT_NO_THROW(cfg.add(subnet0)); ASSERT_NO_THROW(cfg.add(subnet1)); ASSERT_NO_THROW(cfg.add(subnet2)); ASSERT_NO_THROW(cfg.add(subnet3)); @@ -2163,6 +2166,14 @@ TEST(CfgSubnets4Test, getLinks) { expected = { 20 }; EXPECT_EQ(expected, links); EXPECT_EQ(24, link_len); + + // Even it is not used for Bulk Leasequery, it works for 0.0.0.0 too. + links.clear(); + link_len = 111; + EXPECT_NO_THROW(links = cfg.getLinks(IOAddress("0.0.0.0"), link_len)); + expected = { 111 }; + EXPECT_EQ(expected, links); + EXPECT_EQ(24, link_len); } } // end of anonymous namespace diff --git a/src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc b/src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc index 49031a4cb7..bfba04e0b4 100644 --- a/src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc @@ -2009,7 +2009,9 @@ TEST(CfgSubnets6Test, hostPD) { TEST(CfgSubnets6Test, getLinks) { CfgSubnets6 cfg; - // Create 3 subnets. + // Create 4 subnets. + Subnet6Ptr subnet0(new Subnet6(IOAddress("::"), 48, 1, 2, 3, 4, + SubnetID(111))); Subnet6Ptr subnet1(new Subnet6(IOAddress("2001:db8:1::"), 64, 1, 2, 3, 4, SubnetID(1))); Subnet6Ptr subnet2(new Subnet6(IOAddress("2001:db8:2::"), 64, 1, 2, 3, 4, @@ -2018,6 +2020,7 @@ TEST(CfgSubnets6Test, getLinks) { SubnetID(3))); // Add all subnets to the configuration. + ASSERT_NO_THROW(cfg.add(subnet0)); ASSERT_NO_THROW(cfg.add(subnet1)); ASSERT_NO_THROW(cfg.add(subnet2)); ASSERT_NO_THROW(cfg.add(subnet3)); @@ -2085,6 +2088,14 @@ TEST(CfgSubnets6Test, getLinks) { expected = { 20 }; EXPECT_EQ(expected, links); EXPECT_EQ(56, link_len); + + // Even it is not used for Bulk Leasequery, it works for :: too. + links.clear(); + link_len = 111; + EXPECT_NO_THROW(links = cfg.getLinks(IOAddress("::"), link_len)); + expected = { 111 }; + EXPECT_EQ(expected, links); + EXPECT_EQ(48, link_len); } } // end of anonymous namespace