Browse Source

[2786] Option factory function uses iterators to create OptionCustom.

Marcin Siodelski 12 years ago
parent
commit
85b0a75a04
2 changed files with 4 additions and 5 deletions
  1. 3 4
      src/bin/dhcp6/dhcp6_srv.cc
  2. 1 1
      src/lib/dhcp/option_definition.cc

+ 3 - 4
src/bin/dhcp6/dhcp6_srv.cc

@@ -463,10 +463,9 @@ Dhcpv6Srv::createStatusCode(uint16_t code, const std::string& text) {
     assert(status_code_def);
 
     // As there is no dedicated class to represent Status Code
-    // the OptionCustom class should be returned here.
-    boost::shared_ptr<OptionCustom> option_status =
-        boost::dynamic_pointer_cast<
-            OptionCustom>(status_code_def->optionFactory(Option::V6, D6O_STATUS_CODE));
+    // the OptionCustom class is used here instead.
+    OptionCustomPtr option_status =
+        OptionCustomPtr(new OptionCustom(*status_code_def, Option::V6));
     assert(option_status);
 
     // Set status code to 'code' (0 - means data field #0).

+ 1 - 1
src/lib/dhcp/option_definition.cc

@@ -186,7 +186,7 @@ OptionDefinition::optionFactory(Option::Universe u, uint16_t type,
                 }
             }
         }
-        return (OptionPtr(new OptionCustom(*this, u, OptionBuffer(begin, end))));
+        return (OptionPtr(new OptionCustom(*this, u, begin, end)));
 
     } catch (const Exception& ex) {
         isc_throw(InvalidOptionValue, ex.what());