BIND 10 trac3194_1, updated. d7460a8c4d81e973a45b70c27676d87b1a0523d3 [3194] Check if option definition for Vendor option has correct format.

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Oct 23 07:43:51 UTC 2013


The branch, trac3194_1 has been updated
       via  d7460a8c4d81e973a45b70c27676d87b1a0523d3 (commit)
      from  1a0dd0c77ad728edfd20bd329db0019f87fb64a4 (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 d7460a8c4d81e973a45b70c27676d87b1a0523d3
Author: Marcin Siodelski <marcin at isc.org>
Date:   Wed Oct 23 09:43:44 2013 +0200

    [3194] Check if option definition for Vendor option has correct format.

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

Summary of changes:
 src/lib/dhcp/option_definition.cc |   16 ++++++++++++++--
 src/lib/dhcp/option_definition.h  |   22 ++++++++++++++++++++++
 2 files changed, 36 insertions(+), 2 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dhcp/option_definition.cc b/src/lib/dhcp/option_definition.cc
index 1996fc5..ab74dfa 100644
--- a/src/lib/dhcp/option_definition.cc
+++ b/src/lib/dhcp/option_definition.cc
@@ -372,6 +372,16 @@ OptionDefinition::haveClientFqdnFormat() const {
             (record_fields_[1] == OPT_FQDN_TYPE));
 }
 
+bool
+OptionDefinition::haveVendor4Format() const {
+    return (true);
+}
+
+bool
+OptionDefinition::haveVendor6Format() const {
+    return  (getType() == OPT_UINT32_TYPE && !getEncapsulatedSpace().empty());
+}
+
 template<typename T>
 T
 OptionDefinition::lexicalCastWithRangeCheck(const std::string& value_str)
@@ -582,7 +592,8 @@ OptionDefinition::factorySpecialFormatOption(Option::Universe u,
             // a specialized class to handle it.
             return (OptionPtr(new Option6ClientFqdn(begin, end)));
 
-        } else if (getCode() == D6O_VENDOR_OPTS) {
+        } else if (getCode() == D6O_VENDOR_OPTS && haveVendor6Format()) {
+            // Vendor-Specific Information.
             return (OptionPtr(new OptionVendor(Option::V6, begin, end)));
 
         }
@@ -590,7 +601,8 @@ OptionDefinition::factorySpecialFormatOption(Option::Universe u,
         if ((getCode() == DHO_FQDN) && haveFqdn4Format()) {
             return (OptionPtr(new Option4ClientFqdn(begin, end)));
 
-        } else if (getCode() == DHO_VIVSO_SUBOPTIONS) {
+        } else if (getCode() == DHO_VIVSO_SUBOPTIONS && haveVendor4Format()) {
+            // Vendor-Specific Information.
             return (OptionPtr(new OptionVendor(Option::V4, begin, end)));
 
         }
diff --git a/src/lib/dhcp/option_definition.h b/src/lib/dhcp/option_definition.h
index ade056c..7db32fa 100644
--- a/src/lib/dhcp/option_definition.h
+++ b/src/lib/dhcp/option_definition.h
@@ -297,6 +297,28 @@ public:
     /// %Option.
     bool haveFqdn4Format() const;
 
+    /// @brief Check if the option has format of Vendor-Identifying Vendor
+    /// Specific Options.
+    ///
+    /// @return Always true.
+    /// @todo The Vendor-Identifying Vendor-Specific Option has a complex format
+    /// which we do not support here. Therefore it is not really possible to
+    /// check that the current definition is valid. We may need to add support
+    /// for such option format or simply do not check the format for certain
+    /// options, e.g. vendor options, IA_NA, IAADDR and always return objects
+    /// of the certain type.
+    bool haveVendor4Format() const;
+
+    /// @brief Check if option has a format of the Vendor-Specific Information
+    /// %Option.
+    ///
+    /// The Vendor-Specific Information %Option comprises 32-bit enterprise id
+    /// and the suboptions.
+    ///
+    /// @return true if option definition conforms to the format of the
+    /// Vendor-Specific Information %Option.
+    bool haveVendor6Format() const;
+
     /// @brief Option factory.
     ///
     /// This function creates an instance of DHCP option using



More information about the bind10-changes mailing list