From: Andrei Pavel Date: Tue, 18 May 2021 11:56:54 +0000 (+0300) Subject: [#1894] limit docsis oro lookup to cable labs 4491 X-Git-Tag: Kea-1.9.9~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=272b4f57d37372fd20c4487caabf380a2be66f10;p=thirdparty%2Fkea.git [#1894] limit docsis oro lookup to cable labs 4491 --- diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index 6c943ead56..22e525c031 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -1809,15 +1809,22 @@ Dhcpv4Srv::appendRequestedVendorOptions(Dhcpv4Exchange& ex) { std::vector 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(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(oro_generic); + // Get the list of options that client requested. + if (oro) { + requested_opts = oro->getValues(); + } } } diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index b593d07293..da6e9bcff0 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -1457,13 +1457,17 @@ Dhcpv6Srv::appendRequestedVendorOptions(const Pkt6Ptr& question, std::vector 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 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(oro_generic); if (oro) { requested_opts = oro->getValues();