]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2643] Addressed comments
authorFrancis Dupont <fdupont@isc.org>
Mon, 21 Nov 2022 14:31:05 +0000 (15:31 +0100)
committerFrancis Dupont <fdupont@isc.org>
Mon, 21 Nov 2022 14:32:13 +0000 (15:32 +0100)
src/lib/dhcpsrv/cfg_subnets4.h
src/lib/dhcpsrv/cfg_subnets6.h
src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc
src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc

index 1305b6cb9e85feed39f02a52f57b67d4b63b420e..d1d3c32184788b9335c06f24024de19c369c7789 100644 (file)
@@ -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
index a8b59e2327bbbcd8b18ea202faebb89aadc95788..54f377446004143770fd86b8c8dbf9bb29eafb08 100644 (file)
@@ -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
index bba6f2e125f6fab7994ee60f29a6760f17e43ea9..f2bafc35e29e2974adc8f0b78762ee72952ef71f 100644 (file)
@@ -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
index 49031a4cb72603dc25781639a17e1bf560854062..bfba04e0b4d870a0e068008a085e47dfef444438 100644 (file)
@@ -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