From: Marcin Siodelski Date: Fri, 25 Oct 2013 07:56:32 +0000 (+0200) Subject: [master] Merge branch 'trac3194_1' X-Git-Tag: bind10-1.2.0beta1-release~102^2~45 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=db31405ea79f587bb7a1ec9b94c02edacb758271;p=thirdparty%2Fkea.git [master] Merge branch 'trac3194_1' --- db31405ea79f587bb7a1ec9b94c02edacb758271 diff --cc src/lib/dhcp/option_definition.cc index c75c6f91dd,e94097c811..952c758e3a --- a/src/lib/dhcp/option_definition.cc +++ b/src/lib/dhcp/option_definition.cc @@@ -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));