]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Merge branch 'trac3194_1'
authorMarcin Siodelski <marcin@isc.org>
Fri, 25 Oct 2013 07:56:32 +0000 (09:56 +0200)
committerMarcin Siodelski <marcin@isc.org>
Fri, 25 Oct 2013 07:56:32 +0000 (09:56 +0200)
1  2 
src/lib/dhcp/libdhcp++.cc
src/lib/dhcp/libdhcp++.h
src/lib/dhcp/option_definition.cc
src/lib/dhcp/tests/libdhcp++_unittest.cc

Simple merge
Simple merge
index c75c6f91dd4357a81f12f0b9f416cae59eaa7421,e94097c811090f7466baf981b80b2f8adad5818b..952c758e3aeb2eae4c6eebd5b5e6d97299d918a8
@@@ -115,14 -116,22 +116,26 @@@ OptionDefinition::optionFactory(Option:
                                  OptionBufferConstIter begin,
                                  OptionBufferConstIter end,
                                  UnpackOptionsCallback callback) const {
      try {
+         // Some of the options are represented by the specialized classes derived
+         // from Option class (e.g. IA_NA, IAADDR). Although, they can be also
+         // represented by the generic classes, we want the object of the specialized
+         // type to be returned. Therefore, we first check that if we are dealing
+         // with such an option. If the instance is returned we just exit at this
+         // point. If not, we will search for a generic option type to return.
+         OptionPtr option = factorySpecialFormatOption(u, begin, end, callback);
+         if (option) {
+             return (option);
+         }
          switch(type_) {
          case OPT_EMPTY_TYPE:
 -            return (factoryEmpty(u, type));
 +            if (getEncapsulatedSpace().empty()) {
 +                    return (factoryEmpty(u, type));
 +            } else {
 +                return (OptionPtr(new OptionCustom(*this, u, begin, end)));
 +            }
  
          case OPT_BINARY_TYPE:
              return (factoryGeneric(u, type, begin, end));