2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 14:05:33 +00:00

[2315] Group options held under Subnet object by option space name.

This commit is contained in:
Marcin Siodelski
2013-01-03 13:54:50 +01:00
parent bef01123fb
commit 5530bff261
8 changed files with 127 additions and 49 deletions

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-2013 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
@@ -894,7 +894,7 @@ public:
subnet->addPool4(*it);
}
const Subnet::OptionContainer& options = subnet->getOptions();
const Subnet::OptionContainer& options = subnet->getOptions("dhcp4");
const Subnet::OptionContainerTypeIndex& idx = options.get<1>();
// Add subnet specific options.
@@ -904,7 +904,7 @@ public:
LOG_WARN(dhcp4_logger, DHCP4_CONFIG_OPTION_DUPLICATE)
.arg(desc.option->getType()).arg(addr.toText());
}
subnet->addOption(desc.option);
subnet->addOption(desc.option, false, "dhcp4");
}
// Check all global options and add them to the subnet object if
@@ -914,6 +914,8 @@ public:
BOOST_FOREACH(Subnet::OptionDescriptor desc, option_defaults) {
// Get all options specified locally in the subnet and having
// code equal to global option's code.
const Subnet::OptionContainer& options = subnet->getOptions("dhcp4");
const Subnet::OptionContainerTypeIndex& idx = options.get<1>();
Subnet::OptionContainerTypeRange range = idx.equal_range(desc.option->getType());
// @todo: In the future we will be searching for options using either
// an option code or namespace. Currently we have only the option
@@ -924,7 +926,7 @@ public:
// want to issue a warning about dropping the configuration of
// a global option if one already exsists.
if (std::distance(range.first, range.second) == 0) {
subnet->addOption(desc.option);
subnet->addOption(desc.option, false, "dhcp4");
}
}