]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1894] limit docsis oro lookup to cable labs 4491
authorAndrei Pavel <andrei@isc.org>
Tue, 18 May 2021 11:56:54 +0000 (14:56 +0300)
committerAndrei Pavel <andrei@isc.org>
Fri, 25 Jun 2021 13:24:35 +0000 (16:24 +0300)
src/bin/dhcp4/dhcp4_srv.cc
src/bin/dhcp6/dhcp6_srv.cc

index 6c943ead563a6e34764ad0343dcf92a47729cc47..22e525c0311959fd29e57efa23f98963b36903d3 100644 (file)
@@ -1809,15 +1809,22 @@ Dhcpv4Srv::appendRequestedVendorOptions(Dhcpv4Exchange& ex) {
 
     std::vector<uint8_t> requested_opts;
 
-    // Let's try to get ORO within that vendor-option
-    /// @todo This is very specific to vendor-id=4491 (Cable Labs). Other
-    /// vendors may have different policies.
+    // Let's try to get ORO within that vendor-option.
+    // This is specific to vendor-id=4491 (Cable Labs). Other vendors may have
+    // different policies.
     OptionUint8ArrayPtr oro;
-    if (vendor_req) {
-        oro = boost::dynamic_pointer_cast<OptionUint8Array>(vendor_req->getOption(DOCSIS3_V4_ORO));
-        // Get the list of options that client requested.
-        if (oro) {
-            requested_opts = oro->getValues();
+    if (vendor_id == VENDOR_ID_CABLE_LABS && vendor_req) {
+        OptionPtr oro_generic = vendor_req->getOption(DOCSIS3_V4_ORO);
+        if (oro_generic) {
+            // Vendor ID 4491 makes Kea look at DOCSIS3_V4_OPTION_DEFINITIONS
+            // when parsing options. Based on that, oro_generic will have been
+            // created as an OptionUint8Array, but might not be for other
+            // vendor IDs.
+            oro = boost::dynamic_pointer_cast<OptionUint8Array>(oro_generic);
+            // Get the list of options that client requested.
+            if (oro) {
+                requested_opts = oro->getValues();
+            }
         }
     }
 
index b593d07293d255cdf0d875fac3ef6c1469180004..da6e9bcff0763edff0dfb6081fd47f0f9b3c85b9 100644 (file)
@@ -1457,13 +1457,17 @@ Dhcpv6Srv::appendRequestedVendorOptions(const Pkt6Ptr& question,
 
     std::vector<uint16_t> requested_opts;
 
-    // Let's try to get ORO within that vendor-option
-    /// @todo This is very specific to vendor-id=4491 (Cable Labs). Other vendors
-    /// may have different policies.
-    boost::shared_ptr<OptionUint16Array> oro;
-    if (vendor_req) {
+    // Let's try to get ORO within that vendor-option.
+    // This is specific to vendor-id=4491 (Cable Labs). Other vendors may have
+    // different policies.
+    OptionUint16ArrayPtr oro;
+    if (vendor_id == VENDOR_ID_CABLE_LABS && vendor_req) {
         OptionPtr oro_generic = vendor_req->getOption(DOCSIS3_V6_ORO);
         if (oro_generic) {
+            // Vendor ID 4491 makes Kea look at DOCSIS3_V6_OPTION_DEFINITIONS
+            // when parsing options. Based on that, oro_generic will have been
+            // created as an OptionUint16Array, but might not be for other
+            // vendor IDs.
             oro = boost::dynamic_pointer_cast<OptionUint16Array>(oro_generic);
             if (oro) {
                 requested_opts = oro->getValues();