BIND 10 pd-ietf-demo, updated. 7fb56c6b244dd14552791f8552b3ad85a07bfd76 [pd-ietf-demo] Do not duplicate options in responses from the server.

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Oct 17 12:21:17 UTC 2013


The branch, pd-ietf-demo has been updated
       via  7fb56c6b244dd14552791f8552b3ad85a07bfd76 (commit)
      from  9c506fb40b27c7478cebbaae932c6b74348c4f42 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 7fb56c6b244dd14552791f8552b3ad85a07bfd76
Author: Marcin Siodelski <marcin at isc.org>
Date:   Thu Oct 17 14:21:10 2013 +0200

    [pd-ietf-demo] Do not duplicate options in responses from the server.

-----------------------------------------------------------------------

Summary of changes:
 src/bin/dhcp4/dhcp4_srv.cc |   28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc
index bcea103..e1b2d7d 100644
--- a/src/bin/dhcp4/dhcp4_srv.cc
+++ b/src/bin/dhcp4/dhcp4_srv.cc
@@ -638,10 +638,12 @@ Dhcpv4Srv::appendRequestedOptions(const Pkt4Ptr& question, Pkt4Ptr& msg) {
     // to be returned to the client.
     for (std::vector<uint8_t>::const_iterator opt = requested_opts.begin();
          opt != requested_opts.end(); ++opt) {
-        Subnet::OptionDescriptor desc =
-            subnet->getOptionDescriptor("dhcp4", *opt);
-        if (desc.option) {
-            msg->addOption(desc.option);
+        if (!msg->getOption(*opt)) {
+            Subnet::OptionDescriptor desc =
+                subnet->getOptionDescriptor("dhcp4", *opt);
+            if (desc.option && !msg->getOption(*opt)) {
+                msg->addOption(desc.option);
+            }
         }
     }
 }
@@ -690,15 +692,18 @@ Dhcpv4Srv::appendRequestedVendorOptions(const Pkt4Ptr& question, Pkt4Ptr& answer
 
     for (OptionBuffer::const_iterator code = requested_opts.begin();
          code != requested_opts.end(); ++code) {
-        Subnet::OptionDescriptor desc = subnet->getVendorOptionDescriptor(vendor_id, *code);
-        if (desc.option) {
-            vendor_rsp->addOption(desc.option);
-            added = true;
+        if  (!vendor_rsp->getOption(*code)) {
+            Subnet::OptionDescriptor desc = subnet->getVendorOptionDescriptor(vendor_id,
+                                                                              *code);
+            if (desc.option) {
+                vendor_rsp->addOption(desc.option);
+                added = true;
+            }
         }
-    }
 
-    if (added) {
-        answer->addOption(vendor_rsp);
+        if (added) {
+            answer->addOption(vendor_rsp);
+        }
     }
 }
 
@@ -708,7 +713,6 @@ Dhcpv4Srv::appendBasicOptions(const Pkt4Ptr& question, Pkt4Ptr& msg) {
     // Identify options that we always want to send to the
     // client (if they are configured).
     static const uint16_t required_options[] = {
-        DHO_SUBNET_MASK,
         DHO_ROUTERS,
         DHO_DOMAIN_NAME_SERVERS,
         DHO_DOMAIN_NAME };



More information about the bind10-changes mailing list