From: Tomek Mrugalski Date: Tue, 11 Apr 2017 16:51:31 +0000 (+0200) Subject: [5207] Reverted part of earlier comments, add4/add6 description updated X-Git-Tag: trac5213_base~3^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=501190d8845f85d5ed28f5e9c44818dcd5f0d0bf;p=thirdparty%2Fkea.git [5207] Reverted part of earlier comments, add4/add6 description updated --- diff --git a/src/lib/dhcpsrv/cfg_hosts.cc b/src/lib/dhcpsrv/cfg_hosts.cc index 7b5efd900f..4453c92d58 100644 --- a/src/lib/dhcpsrv/cfg_hosts.cc +++ b/src/lib/dhcpsrv/cfg_hosts.cc @@ -602,11 +602,6 @@ CfgHosts::add4(const HostPtr& host) { "options"); } - if (host->getIPv4SubnetID() == 0) { - // This is IPv6-only host. No need to add it to v4 tables. - return; - } - // Check for duplicates for the specified IPv4 subnet. if ((host->getIPv4SubnetID() > 0) && get4(host->getIPv4SubnetID(), hwaddr, duid)) { @@ -668,17 +663,6 @@ CfgHosts::add6(const HostPtr& host) { // Get all reservations for this host. IPv6ResrvRange reservations = host->getIPv6Reservations(); - // Check if the (identifier type, identifier) tuple is already used. - const std::vector& id = host->getIdentifier(); - if ((host->getIPv6SubnetID() > 0) && !id.empty()) { - if (get6(host->getIPv6SubnetID(), host->getIdentifierType(), &id[0], - id.size())) { - isc_throw(DuplicateHost, "failed to add duplicate IPv6 host using identifier: " - << Host::getIdentifierAsText(host->getIdentifierType(), - &id[0], id.size())); - } - } - // Check if there are any IPv6 reservations. if (std::distance(reservations.first, reservations.second) == 0) { // If there aren't, we don't need to add this to hosts6_, which is used diff --git a/src/lib/dhcpsrv/cfg_hosts.h b/src/lib/dhcpsrv/cfg_hosts.h index f495701f30..4575c42d0b 100644 --- a/src/lib/dhcpsrv/cfg_hosts.h +++ b/src/lib/dhcpsrv/cfg_hosts.h @@ -476,9 +476,12 @@ private: ReturnType getHostInternal6(const asiolink::IOAddress& prefix, const uint8_t prefix_len) const; - /// @brief Adds a new host to the v4 collection. + /// @brief Adds a new host to the collection. /// - /// This is an internal method called by public @ref add. + /// This is an internal method called by public @ref add. Contrary to its + /// name, this is useful for both IPv4 and IPv6 hosts, as this adds the + /// host to hosts_ storage that is shared by both families. Notes that + /// for IPv6 host additional steps may be required (see @ref add6). /// /// @param host Pointer to the new @c Host object being added. /// @@ -486,9 +489,11 @@ private: /// has already been added to the IPv4 subnet. virtual void add4(const HostPtr& host); - /// @brief Adds a new host to the v6 collection. + /// @brief Adds IPv6-specific reservation to hosts collection. /// - /// This is an internal method called by public @ref add. + /// This is an internal method called by public @ref add. This method adds + /// IPv6 reservations (IPv6 addresses or prefixes reserved) to the hosts6_ + /// storage. Note the host has been added to the hosts_ already (in @ref add4). /// /// @param host Pointer to the new @c Host object being added. ///