]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3689] Performance optimization in the appendRequestedOptions.
authorMarcin Siodelski <marcin@isc.org>
Wed, 18 Mar 2015 08:35:10 +0000 (09:35 +0100)
committerMarcin Siodelski <marcin@isc.org>
Wed, 18 Mar 2015 08:35:10 +0000 (09:35 +0100)
src/bin/dhcp6/dhcp6_srv.cc

index 7c757b78d7cfd094bf853d58babed9c7764b0496..5a216741a13923eeca25bbd72dbf1f307b416488 100644 (file)
@@ -765,7 +765,9 @@ Dhcpv6Srv::appendRequestedOptions(const Pkt6Ptr& question, Pkt6Ptr& answer,
     // Get the list of options that client requested.
     const std::vector<uint16_t>& 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_);
+            }
         }
     }
 }