2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-05 00:15:17 +00:00

[#2765] addressed review comments

This commit is contained in:
Razvan Becheriu
2023-03-11 21:43:51 +02:00
parent df9c6d52e7
commit 43f048fea0
4 changed files with 77 additions and 73 deletions

View File

@@ -1854,7 +1854,8 @@ Dhcpv4Srv::appendRequestedOptions(Dhcpv4Exchange& ex) {
desc != range.second; ++desc) {
// Add the persistent option code to requested options
if (desc->option_) {
static_cast<void>(requested_opts.insert(desc->option_->getType()));
uint16_t code = desc->option_->getType();
static_cast<void>(requested_opts.insert(code));
}
}
}
@@ -1891,7 +1892,8 @@ Dhcpv4Srv::appendRequestedOptions(Dhcpv4Exchange& ex) {
OptionVendorClassPtr vendor_opts;
vendor_opts = boost::dynamic_pointer_cast<OptionVendorClass>(opt.second);
if (vendor_opts) {
static_cast<void>(vendor_ids.insert(vendor_opts->getVendorId()));
uint32_t vendor_id = vendor_opts->getVendorId();
static_cast<void>(vendor_ids.insert(vendor_id));
}
}
// Iterate on the configured option list.
@@ -1927,7 +1929,8 @@ Dhcpv4Srv::appendRequestedOptions(Dhcpv4Exchange& ex) {
OptionVendorPtr vendor_opts;
vendor_opts = boost::dynamic_pointer_cast<OptionVendor>(opt.second);
if (vendor_opts) {
static_cast<void>(vendor_ids.insert(vendor_opts->getVendorId()));
uint32_t vendor_id = vendor_opts->getVendorId();
static_cast<void>(vendor_ids.insert(vendor_id));
}
}
// Iterate on the configured option list
@@ -1963,6 +1966,7 @@ Dhcpv4Srv::appendRequestedVendorOptions(Dhcpv4Exchange& ex) {
Subnet4Ptr subnet = ex.getContext()->subnet_;
const CfgOptionList& co_list = ex.getCfgOptionList();
// Leave if there is no subnet matching the incoming packet.
// There is no need to log the error message here because
// it will be logged in the assignLease() when it fails to
@@ -2004,6 +2008,17 @@ Dhcpv4Srv::appendRequestedVendorOptions(Dhcpv4Exchange& ex) {
}
}
// Finally, try to get the vendor-id from the client packet's vendor-class
// option (124).
for (auto opt : query->getOptions(DHO_VIVCO_SUBOPTIONS)) {
OptionVendorClassPtr vendor_class;
vendor_class = boost::dynamic_pointer_cast<OptionVendorClass>(opt.second);
if (vendor_class) {
uint32_t vendor_id = vendor_class->getVendorId();
static_cast<void>(vendor_ids.insert(vendor_id));
}
}
// If there's no vendor option in either request or response, then there's no way
// to figure out what the vendor-id values are and we give up.
if (vendor_ids.empty()) {
@@ -2051,7 +2066,8 @@ Dhcpv4Srv::appendRequestedVendorOptions(Dhcpv4Exchange& ex) {
continue;
}
// Add the persistent option code to requested options
static_cast<void>(requested_opts[vendor_id].insert(desc->option_->getType()));
uint16_t code = desc->option_->getType();
static_cast<void>(requested_opts[vendor_id].insert(code));
}
}