Browse Source

[5227] Addressed review comments

Francis Dupont 7 years ago
parent
commit
2509c77bf8
2 changed files with 9 additions and 4 deletions
  1. 4 4
      src/lib/dhcp/option6_status_code.cc
  2. 5 0
      src/lib/dhcp/option6_status_code.h

+ 4 - 4
src/lib/dhcp/option6_status_code.cc

@@ -21,7 +21,7 @@ namespace {
 
 
 /// @brief Minimum length of the option (when status message is empty).
 /// @brief Minimum length of the option (when status message is empty).
 const size_t OPTION6_STATUS_CODE_MIN_LEN = sizeof(uint16_t);
 const size_t OPTION6_STATUS_CODE_MIN_LEN = sizeof(uint16_t);
-const size_t OPTION4_SLP_SERVICE_SCOPEMIN_LEN = sizeof(bool);
+const size_t OPTION4_SLP_SERVICE_SCOPEMIN_LEN = sizeof(uint8_t);
 
 
 }; // end of anonymous namespace
 }; // end of anonymous namespace
 
 
@@ -39,7 +39,7 @@ Option6StatusCode::Option6StatusCode(OptionBufferConstIter begin,
     : Option(Option::V6, D6O_STATUS_CODE),
     : Option(Option::V6, D6O_STATUS_CODE),
       status_code_(STATUS_Success), status_message_() {
       status_code_(STATUS_Success), status_message_() {
 
 
-    // Parse data 
+    // Parse data
     unpack(begin, end);
     unpack(begin, end);
 }
 }
 
 
@@ -149,7 +149,7 @@ Option4SlpServiceScope::Option4SlpServiceScope(OptionBufferConstIter begin,
     : Option(Option::V4, DHO_SERVICE_SCOPE),
     : Option(Option::V4, DHO_SERVICE_SCOPE),
       mandatory_flag_(false), scope_list_() {
       mandatory_flag_(false), scope_list_() {
 
 
-    // Parse data 
+    // Parse data
     unpack(begin, end);
     unpack(begin, end);
 }
 }
 
 
@@ -188,7 +188,7 @@ Option4SlpServiceScope::unpack(OptionBufferConstIter begin, OptionBufferConstIte
         isc_throw(BadDataTypeCast, "unable to read the buffer as boolean"
         isc_throw(BadDataTypeCast, "unable to read the buffer as boolean"
                   << " value. Invalid value " << static_cast<int>(*begin));
                   << " value. Invalid value " << static_cast<int>(*begin));
     }
     }
-    begin += sizeof(bool);
+    begin += sizeof(uint8_t);
 
 
     scope_list_.assign(begin, end);
     scope_list_.assign(begin, end);
 }
 }

+ 5 - 0
src/lib/dhcp/option6_status_code.h

@@ -50,6 +50,8 @@ public:
 
 
     /// @brief Parses received buffer.
     /// @brief Parses received buffer.
     ///
     ///
+    /// @throw OutOfRange if specified option is truncated
+    ///
     /// @param begin Iterator to first byte of option data
     /// @param begin Iterator to first byte of option data
     /// @param end Iterator to end of option data (first byte after option end)
     /// @param end Iterator to end of option data (first byte after option end)
     virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end);
     virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end);
@@ -144,6 +146,9 @@ public:
 
 
     /// @brief Parses received buffer.
     /// @brief Parses received buffer.
     ///
     ///
+    /// @throw OutOfRange if specified option is truncated
+    /// @throw BadDataTypeCast if first byte is not 0 or 1
+    ///
     /// @param begin Iterator to first byte of option data
     /// @param begin Iterator to first byte of option data
     /// @param end Iterator to end of option data (first byte after option end)
     /// @param end Iterator to end of option data (first byte after option end)
     virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end);
     virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end);