]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#659,!387] Addressed two review comments.
authorMarcin Siodelski <marcin@isc.org>
Fri, 16 Aug 2019 11:19:29 +0000 (13:19 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Fri, 16 Aug 2019 15:47:34 +0000 (17:47 +0200)
- Return after finding the first pool.
- Corrected excluded prefix length stored in the db.

src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc
src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_unittest.cc

index ccf661e31f5e0504f827319b2a714afb4a41e739..dcda8d9eda11723e51912ffbb65a71e9ea145a5e 100644 (file)
@@ -1047,16 +1047,15 @@ public:
             };
 
             getPools(GET_POOL6_RANGE, in_bindings, pools, pool_ids);
-            // Break if something is found?
-        }
 
-        if (!pools.empty()) {
-            pool_id = pool_ids[0];
-            return (boost::dynamic_pointer_cast<Pool6>(*pools.begin()));
+            // Return upon the first pool found.
+            if (!pools.empty()) {
+                pool_id = pool_ids[0];
+                return (boost::dynamic_pointer_cast<Pool6>(*pools.begin()));
+            }
         }
 
         pool_id = 0;
-
         return (Pool6Ptr());
     }
 
@@ -1313,7 +1312,7 @@ public:
         const Option6PDExcludePtr& xopt = pd_pool->getPrefixExcludeOption();
         if (xopt) {
             const IOAddress& prefix = pd_pool->getFirstAddress();
-            const IOAddress& xprefix = xopt->getExcludedPrefix(prefix, plen);
+            const IOAddress& xprefix = xopt->getExcludedPrefix(prefix, pd_pool->getLength());
             xprefix_txt = xprefix.toText();
             xlen = xopt->getExcludedPrefixLength();
         }
index 13ade5d5de5a351b1eca6818d3915d4f4b50c039..b513b89ead4761552b5908d474210509ec23614b 100644 (file)
@@ -241,8 +241,10 @@ public:
                                      test_options_[4]->persistent_,
                                      test_options_[4]->space_name_);
 
-        pdpool2.reset(new Pool6(Lease::TYPE_PD,
-                                IOAddress("2001:db8:d::"), 48, 64));
+        // Create the prefix delegation pool with an excluded prefix.
+        pdpool2.reset(new Pool6(IOAddress("2001:db8:d::"), 48, 64,
+                                IOAddress("2001:db8:d::2000"), 120));
+
         subnet->addPool(pdpool2);
 
         pdpool2->allowClientClass("work");