Browse Source

[3320] Address review comments.

Marcin Siodelski 10 years ago
parent
commit
c584eade3b

+ 1 - 1
src/bin/dhcp4/dhcp4_messages.mes

@@ -147,7 +147,7 @@ point, the setting of the flag instructs the server not to choose a
 subnet, an action that severely limits further processing; the server
 will be only able to offer global options - no addresses will be assigned.
 
-% DHCP4_INVALID_ADDRESS_INIT_REBOOT client having client-id %1, hwaddr %2 and being in the INIT-REBOOT state requested invalid address %3
+% DHCP4_INVALID_ADDRESS_INIT_REBOOT invalid address %1 requested by INIT-REBOOT client (id: %2, hwaddr: %3)
 This debug message is issued when the client being in the INIT-REBOOT state
 requested an address which is not assigned to him. The server will respond
 to this client with DHCPNAK.

+ 3 - 3
src/bin/dhcp4/dhcp4_srv.cc

@@ -976,9 +976,9 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) {
         if (!lease) {
             LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL,
                       DHCP4_INVALID_ADDRESS_INIT_REBOOT)
+                .arg(hint.toText())
                 .arg(client_id ? client_id->toText():"(no client-id)")
-                .arg(hwaddr ? hwaddr->toText():"(no hwaddr info)")
-                .arg(hint.toText());
+                .arg(hwaddr ? hwaddr->toText():"(no hwaddr info)");
 
             answer->setType(DHCPNAK);
             answer->setYiaddr(IOAddress("0.0.0.0"));
@@ -1111,7 +1111,7 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) {
 
     } else {
         // Allocation engine did not allocate a lease. The engine logged
-        // cause of that failure. The onlxy thing left is to insert
+        // cause of that failure. The only thing left is to insert
         // status code to pass the sad news to the client.
 
         LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL, fake_allocation?

+ 5 - 1
src/bin/dhcp4/tests/dhcp4_client.cc

@@ -243,7 +243,11 @@ Dhcp4Client::doRequest() {
 
 void
 Dhcp4Client::includePRL() {
-    if (!requested_options_.empty() && context_.query_) {
+    if (!context_.query_) {
+        isc_throw(Dhcp4ClientError, "pointer to the query must not be NULL"
+                  " when adding option codes to the PRL option");
+
+    } else if (!requested_options_.empty()) {
         // Include Parameter Request List if at least one option code
         // has been specified to be requested.
         OptionUint8ArrayPtr prl(new OptionUint8Array(Option::V4,

+ 6 - 5
src/bin/dhcp4/tests/dhcp4_client.h

@@ -173,7 +173,7 @@ public:
     /// - SELECTING - client is trying to obtain a new lease and it has selected
     /// the server using the DHCPDISCOVER.
     /// - INIT-REBOOT - client cached an address it was previously using and is
-    /// now trying to verify if this addres is still valid.
+    /// now trying to verify if this address is still valid.
     /// - RENEW - client's renewal timer has passed and the client is trying to
     /// extend the lifetime of the lease.
     /// - REBIND - client's rebind timer has passed and the client is trying to
@@ -296,7 +296,7 @@ public:
 
 private:
 
-    /// @brief Creates and addds Requested IP Address option to the client's
+    /// @brief Creates and adds Requested IP Address option to the client's
     /// query.
     ///
     /// @param addr Address to be added in the Requested IP Address option.
@@ -324,9 +324,10 @@ private:
 
     /// @brief Include PRL Option in the query message.
     ///
-    /// This function creates the instance of the PRL option and adds
-    /// option codes from the @c requested_options_ to it. It later adds
-    /// the PRL option to the @c context_.query_ message if it is non-NULL.
+    /// This function creates the instance of the PRL (Parameter Request List)
+    /// option and adds option codes from the @c requested_options_ to it.
+    /// It later adds the PRL option to the @c context_.query_ message
+    /// if it is non-NULL.
     void includePRL();
 
     /// @brief Simulates reception of the message from the server.