From: Marcin Siodelski Date: Wed, 18 Mar 2015 08:35:10 +0000 (+0100) Subject: [3689] Performance optimization in the appendRequestedOptions. X-Git-Tag: kea-0.9.1~8^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c291fe71e705849f08150b11c9effb8ec021e23;p=thirdparty%2Fkea.git [3689] Performance optimization in the appendRequestedOptions. --- diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index 7c757b78d7..5a216741a1 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -765,7 +765,9 @@ Dhcpv6Srv::appendRequestedOptions(const Pkt6Ptr& question, Pkt6Ptr& answer, // Get the list of options that client requested. const std::vector& requested_opts = option_oro->getValues(); BOOST_FOREACH(uint16_t opt, requested_opts) { - // If we found a subnet for this client, try subnet first. + // If we found a subnet for this client, all options (including the + // global options) should be available through the options + // configuration for the subnet. if (ctx.subnet_) { OptionDescriptor desc = ctx.subnet_->getCfgOption()->get("dhcp6", opt); @@ -774,12 +776,14 @@ Dhcpv6Srv::appendRequestedOptions(const Pkt6Ptr& question, Pkt6Ptr& answer, answer->addOption(desc.option_); continue; } - } - // If subnet specific option is not there, try global. - OptionDescriptor desc = global_opts->get("dhcp6", opt); - if (desc.option_) { - answer->addOption(desc.option_); + // If there is no subnet selected (e.g. Information-request message + // case) we need to look at the global options. + } else { + OptionDescriptor desc = global_opts->get("dhcp6", opt); + if (desc.option_) { + answer->addOption(desc.option_); + } } } }