From: Marcin Siodelski Date: Fri, 16 Aug 2019 11:19:29 +0000 (+0200) Subject: [#659,!387] Addressed two review comments. X-Git-Tag: Kea-1.6.0~41^2~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f2cae397b48e2a28a7a7e61f6392691b9d32c13;p=thirdparty%2Fkea.git [#659,!387] Addressed two review comments. - Return after finding the first pool. - Corrected excluded prefix length stored in the db. --- diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc index ccf661e31f..dcda8d9eda 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc @@ -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(*pools.begin())); + // Return upon the first pool found. + if (!pools.empty()) { + pool_id = pool_ids[0]; + return (boost::dynamic_pointer_cast(*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(); } diff --git a/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_unittest.cc b/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_unittest.cc index 13ade5d5de..b513b89ead 100644 --- a/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_unittest.cc +++ b/src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_unittest.cc @@ -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");