Browse Source

[5207] Reverted part of earlier comments, add4/add6 description updated

Tomek Mrugalski 8 years ago
parent
commit
501190d884
2 changed files with 9 additions and 20 deletions
  1. 0 16
      src/lib/dhcpsrv/cfg_hosts.cc
  2. 9 4
      src/lib/dhcpsrv/cfg_hosts.h

+ 0 - 16
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<uint8_t>& 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

+ 9 - 4
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.
     ///