Parcourir la source

[4321] Cosmetics changes (no real code change)

Francis Dupont il y a 8 ans
Parent
commit
b239ccf360

+ 22 - 14
src/bin/dhcp6/tests/dhcp6_client.cc

@@ -55,7 +55,7 @@ struct getLeasesByPropertyFun {
         for (typename std::vector<Lease6>::const_iterator lease =
         for (typename std::vector<Lease6>::const_iterator lease =
                  config.leases_.begin(); lease != config.leases_.end();
                  config.leases_.begin(); lease != config.leases_.end();
              ++lease) {
              ++lease) {
-            // Check if fulfils the condition.
+            // Check if fulfills the condition.
             if ((equals && ((*lease).*MemberPointer) == property) ||
             if ((equals && ((*lease).*MemberPointer) == property) ||
                 (!equals && ((*lease).*MemberPointer) != property)) {
                 (!equals && ((*lease).*MemberPointer) != property)) {
                 // Found the matching lease.
                 // Found the matching lease.
@@ -252,15 +252,18 @@ Dhcp6Client::appendFQDN() {
 void
 void
 Dhcp6Client::appendRequestedIAs(const Pkt6Ptr& query) const {
 Dhcp6Client::appendRequestedIAs(const Pkt6Ptr& query) const {
     BOOST_FOREACH(const ClientIA& ia, client_ias_) {
     BOOST_FOREACH(const ClientIA& ia, client_ias_) {
-        OptionCollection options = query->getOptions(ia.type_ == Lease::TYPE_NA ?
-                                                     D6O_IA_NA : D6O_IA_PD);
+        OptionCollection options =
+            query->getOptions(ia.type_ == Lease::TYPE_NA ?
+                              D6O_IA_NA : D6O_IA_PD);
         std::pair<unsigned int, OptionPtr> option_pair;
         std::pair<unsigned int, OptionPtr> option_pair;
         Option6IAPtr existing_ia;
         Option6IAPtr existing_ia;
         BOOST_FOREACH(option_pair, options) {
         BOOST_FOREACH(option_pair, options) {
-            Option6IAPtr ia_opt = boost::dynamic_pointer_cast<Option6IA>(option_pair.second);
+            Option6IAPtr ia_opt =
+                boost::dynamic_pointer_cast<Option6IA>(option_pair.second);
             // This shouldn't happen.
             // This shouldn't happen.
             if (!ia_opt) {
             if (!ia_opt) {
-                isc_throw(Unexpected, "Dhcp6Client: IA option has an invalid C++ type;"
+                isc_throw(Unexpected,
+                          "Dhcp6Client: IA option has an invalid C++ type;"
                           " this is a programming issue");
                           " this is a programming issue");
             }
             }
             if (ia_opt->getIAID() == ia.iaid_) {
             if (ia_opt->getIAID() == ia.iaid_) {
@@ -280,7 +283,8 @@ Dhcp6Client::appendRequestedIAs(const Pkt6Ptr& query) const {
             BOOST_FOREACH(option_pair, existing_ia->getOptions()) {
             BOOST_FOREACH(option_pair, existing_ia->getOptions()) {
                 Option6IAAddrPtr existing_addr = boost::dynamic_pointer_cast<
                 Option6IAAddrPtr existing_addr = boost::dynamic_pointer_cast<
                     Option6IAAddr>(option_pair.second);
                     Option6IAAddr>(option_pair.second);
-                if (existing_addr && (existing_addr->getAddress() == ia.prefix_)) {
+                if (existing_addr &&
+                    (existing_addr->getAddress() == ia.prefix_)) {
                     option_exists = true;
                     option_exists = true;
                 }
                 }
             }
             }
@@ -289,15 +293,17 @@ Dhcp6Client::appendRequestedIAs(const Pkt6Ptr& query) const {
                 existing_ia->addOption(ia_addr);
                 existing_ia->addOption(ia_addr);
             }
             }
 
 
-        } else if ((ia.type_ == Lease::TYPE_PD) && (!ia.prefix_.isV6Zero() ||
-            (ia.prefix_len_ > 0))) {
-            Option6IAPrefixPtr ia_prefix(new Option6IAPrefix(D6O_IAPREFIX, ia.prefix_,
+        } else if ((ia.type_ == Lease::TYPE_PD) &&
+                   (!ia.prefix_.isV6Zero() || (ia.prefix_len_ > 0))) {
+            Option6IAPrefixPtr ia_prefix(new Option6IAPrefix(D6O_IAPREFIX,
+                                                             ia.prefix_,
                                                              ia.prefix_len_,
                                                              ia.prefix_len_,
                                                              0, 0));
                                                              0, 0));
             BOOST_FOREACH(option_pair, existing_ia->getOptions()) {
             BOOST_FOREACH(option_pair, existing_ia->getOptions()) {
-                Option6IAPrefixPtr existing_prefix = boost::dynamic_pointer_cast<
-                    Option6IAPrefix>(option_pair.second);
-                if (existing_prefix && (existing_prefix->getAddress() == ia.prefix_) &&
+                Option6IAPrefixPtr existing_prefix =
+                    boost::dynamic_pointer_cast<Option6IAPrefix>(option_pair.second);
+                if (existing_prefix &&
+                    (existing_prefix->getAddress() == ia.prefix_) &&
                     existing_prefix->getLength()) {
                     existing_prefix->getLength()) {
                     option_exists = true;
                     option_exists = true;
                 }
                 }
@@ -435,8 +441,10 @@ Dhcp6Client::doSolicit(const bool always_apply_config) {
     // If using Rapid Commit and the server has responded with Reply,
     // If using Rapid Commit and the server has responded with Reply,
     // let's apply received configuration. We also apply the configuration
     // let's apply received configuration. We also apply the configuration
     // for the Advertise if instructed to do so.
     // for the Advertise if instructed to do so.
-    if (context_.response_ && (always_apply_config || (use_rapid_commit_ &&
-        context_.response_->getType() == DHCPV6_REPLY))) {
+    if (context_.response_ &&
+        (always_apply_config ||
+         (use_rapid_commit_ &&
+          context_.response_->getType() == DHCPV6_REPLY))) {
         config_.clear();
         config_.clear();
         applyRcvdConfiguration(context_.response_);
         applyRcvdConfiguration(context_.response_);
     }
     }

+ 18 - 8
src/bin/dhcp6/tests/dhcp6_client.h

@@ -298,7 +298,7 @@ public:
     ///
     ///
     /// This function generates Information-request message, sends it
     /// This function generates Information-request message, sends it
     /// to the server and then receives the reply. Contents of the Inf-Request
     /// to the server and then receives the reply. Contents of the Inf-Request
-    /// are controlled by use_na_, use_pd_, use_client_id_ and use_oro_
+    /// are controlled by client_ias_, use_client_id_ and use_oro_
     /// fields. This method does not process the response in any specific
     /// fields. This method does not process the response in any specific
     /// way, just stores it.
     /// way, just stores it.
     void doInfRequest();
     void doInfRequest();
@@ -367,7 +367,8 @@ public:
     /// @param address Leased address.
     /// @param address Leased address.
     ///
     ///
     /// @return Vector containing leases for the specified address.
     /// @return Vector containing leases for the specified address.
-    std::vector<Lease6> getLeasesByAddress(const asiolink::IOAddress& address) const;
+    std::vector<Lease6>
+        getLeasesByAddress(const asiolink::IOAddress& address) const;
 
 
     /// @brief Returns leases belonging to specified address range.
     /// @brief Returns leases belonging to specified address range.
     ///
     ///
@@ -375,8 +376,9 @@ public:
     /// @param second Upper bound of the address range.
     /// @param second Upper bound of the address range.
     ///
     ///
     /// @return Vector containing leases belonging to specified address range.
     /// @return Vector containing leases belonging to specified address range.
-    std::vector<Lease6> getLeasesByAddressRange(const asiolink::IOAddress& first,
-                                                const asiolink::IOAddress& second) const;
+    std::vector<Lease6>
+        getLeasesByAddressRange(const asiolink::IOAddress& first,
+                                const asiolink::IOAddress& second) const;
 
 
     /// @brief Returns leases belonging to prefix pool.
     /// @brief Returns leases belonging to prefix pool.
     ///
     ///
@@ -385,9 +387,10 @@ public:
     /// @param delegated_len Delegated prefix length.
     /// @param delegated_len Delegated prefix length.
     ///
     ///
     /// @return Vector containing leases belonging to specified prefix pool.
     /// @return Vector containing leases belonging to specified prefix pool.
-    std::vector<Lease6> getLeasesByPrefixPool(const asiolink::IOAddress& prefix,
-                                              const uint8_t prefix_len,
-                                              const uint8_t delegated_len) const;
+    std::vector<Lease6>
+        getLeasesByPrefixPool(const asiolink::IOAddress& prefix,
+                              const uint8_t prefix_len,
+                              const uint8_t delegated_len) const;
 
 
     /// @brief Checks if client has lease for the specified address.
     /// @brief Checks if client has lease for the specified address.
     ///
     ///
@@ -644,6 +647,9 @@ public:
     void useFQDN(const uint8_t flags, const std::string& fqdn_name,
     void useFQDN(const uint8_t flags, const std::string& fqdn_name,
                  Option6ClientFqdn::DomainNameType fqdn_type);
                  Option6ClientFqdn::DomainNameType fqdn_type);
 
 
+    /// @brief Controls whether the client should send an addres in IA_NA
+    ///
+    /// @param send should the address be included?
     void includeAddress(const bool send) {
     void includeAddress(const bool send) {
         include_address_ = send;
         include_address_ = send;
     }
     }
@@ -733,7 +739,7 @@ private:
 
 
     /// @brief Includes IAs to be requested.
     /// @brief Includes IAs to be requested.
     ///
     ///
-    /// This method includes IAs explicitly requested using 
+    /// This method includes IAs explicitly requested using client_ias_
     ///
     ///
     /// @param query Pointer to the client's message to which IAs should be
     /// @param query Pointer to the client's message to which IAs should be
     /// added.
     /// added.
@@ -854,6 +860,10 @@ private:
     /// @brief FQDN requested by the client.
     /// @brief FQDN requested by the client.
     Option6ClientFqdnPtr fqdn_;
     Option6ClientFqdnPtr fqdn_;
 
 
+    /// @brief Determines if the client will include address in the messages
+    ///        it sends.
+    ///
+    /// @todo this flag is currently supported in Decline only.
     bool include_address_;
     bool include_address_;
 };
 };
 
 

+ 2 - 2
src/bin/dhcp6/tests/dhcp6_test_utils.h

@@ -37,14 +37,14 @@ namespace test {
 /// @brief Generic wrapper to provide strongly typed values.
 /// @brief Generic wrapper to provide strongly typed values.
 ///
 ///
 /// In many cases, the test fixture class methods require providing many
 /// In many cases, the test fixture class methods require providing many
-/// paramaters, of which some ore optional. Some of the parameters may also
+/// parameters, of which some are optional. Some of the parameters may also
 /// be implicitly converted to other types. Non-careful test implementer
 /// be implicitly converted to other types. Non-careful test implementer
 /// may often "shift by one" or swap two values on the arguments list, which
 /// may often "shift by one" or swap two values on the arguments list, which
 /// will be accepted by the compiler but will result in troubles running the
 /// will be accepted by the compiler but will result in troubles running the
 /// function. Sometimes it takes non trivial amount of debugging to find out
 /// function. Sometimes it takes non trivial amount of debugging to find out
 /// why the particular function fails until we find that the arguments were
 /// why the particular function fails until we find that the arguments were
 /// swapped or shifted. In addition, the use of classes wrapping simple types
 /// swapped or shifted. In addition, the use of classes wrapping simple types
-/// results in better readbility of the test code.
+/// results in better readability of the test code.
 ///
 ///
 /// @tparam ValueType Type of the wrapped value.
 /// @tparam ValueType Type of the wrapped value.
 template<typename ValueType>
 template<typename ValueType>

+ 5 - 5
src/bin/dhcp6/tests/host_unittest.cc

@@ -116,7 +116,7 @@ const char* CONFIGS[] = {
     "}"
     "}"
 };
 };
 
 
-/// @brief Base class representing leases and hints coveyed within IAs.
+/// @brief Base class representing leases and hints conveyed within IAs.
 ///
 ///
 /// This is a base class for @ref Reservation and @ref Hint classes.
 /// This is a base class for @ref Reservation and @ref Hint classes.
 class IAResource {
 class IAResource {
@@ -353,7 +353,7 @@ public:
     /// number of reservations it checks that for the remaining IAs the
     /// number of reservations it checks that for the remaining IAs the
     /// leases from dynamic pools are assigned.
     /// leases from dynamic pools are assigned.
     ///
     ///
-    /// The strict_iaid_check flag controlls whether the test should verify
+    /// The strict_iaid_check flag controls whether the test should verify
     /// that the address or prefix specified as a hint is assigned by the
     /// that the address or prefix specified as a hint is assigned by the
     /// server to the IA in which the hint was placed by the client.
     /// server to the IA in which the hint was placed by the client.
     ///
     ///
@@ -412,7 +412,7 @@ public:
     /// "01:02:03:04".
     /// "01:02:03:04".
     ///
     ///
     /// @param r1 Reservation 1. Default value is "unspecified" in which case
     /// @param r1 Reservation 1. Default value is "unspecified" in which case
-    /// the reservation will not be included in the configruation.
+    /// the reservation will not be included in the configuration.
     /// @param r2 Reservation 2.
     /// @param r2 Reservation 2.
     /// @param r3 Reservation 3.
     /// @param r3 Reservation 3.
     /// @param r4 Reservation 4.
     /// @param r4 Reservation 4.
@@ -841,7 +841,7 @@ TEST_F(HostTest, sarrAndRebind) {
     EXPECT_EQ("alice", lease_server2->hostname_);
     EXPECT_EQ("alice", lease_server2->hostname_);
 }
 }
 
 
-// This test verfies that the host reservation by DUID is found by the
+// This test verifies that the host reservation by DUID is found by the
 // server.
 // server.
 TEST_F(HostTest, reservationByDUID) {
 TEST_F(HostTest, reservationByDUID) {
     Dhcp6Client client;
     Dhcp6Client client;
@@ -851,7 +851,7 @@ TEST_F(HostTest, reservationByDUID) {
     testReservationByIdentifier(client, 1, "2001:db8:1::2");
     testReservationByIdentifier(client, 1, "2001:db8:1::2");
 }
 }
 
 
-// This test verfies that the host reservation by HW address is found
+// This test verifies that the host reservation by HW address is found
 // by the server.
 // by the server.
 TEST_F(HostTest, reservationByHWAddress) {
 TEST_F(HostTest, reservationByHWAddress) {
     Dhcp6Client client;
     Dhcp6Client client;

+ 2 - 2
src/lib/dhcpsrv/alloc_engine.cc

@@ -589,8 +589,8 @@ AllocEngine::allocateUnreservedLeases6(ClientContext6& ctx) {
     if (pool) {
     if (pool) {
 
 
         /// @todo: We support only one hint for now
         /// @todo: We support only one hint for now
-        Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(ctx.currentIA().type_,
-                                                                hint);
+        Lease6Ptr lease =
+            LeaseMgrFactory::instance().getLease6(ctx.currentIA().type_, hint);
         if (!lease) {
         if (!lease) {
 
 
             // In-pool reservations: Check if this address is reserved for someone
             // In-pool reservations: Check if this address is reserved for someone

+ 1 - 1
src/lib/dhcpsrv/lease.h

@@ -479,7 +479,7 @@ struct Lease6 : public Lease {
     /// @param fqdn_rev If true, reverse DNS update is performed for a lease.
     /// @param fqdn_rev If true, reverse DNS update is performed for a lease.
     /// @param hostname FQDN of the client which gets the lease.
     /// @param hostname FQDN of the client which gets the lease.
     /// @param hwaddr hardware address (MAC), may be NULL
     /// @param hwaddr hardware address (MAC), may be NULL
-    /// @param prefixlen An address prefix length.
+    /// @param prefixlen An address prefix length (optional, defaults to 128)
     Lease6(Lease::Type type, const isc::asiolink::IOAddress& addr, DuidPtr duid,
     Lease6(Lease::Type type, const isc::asiolink::IOAddress& addr, DuidPtr duid,
            uint32_t iaid, uint32_t preferred, uint32_t valid, uint32_t t1,
            uint32_t iaid, uint32_t preferred, uint32_t valid, uint32_t t1,
            uint32_t t2, SubnetID subnet_id, const bool fqdn_fwd,
            uint32_t t2, SubnetID subnet_id, const bool fqdn_fwd,