// Parameters for triggering behaviors compatible with broken or
// non-compliant clients, relays or other agents
"compatibility": {
+ // Ignore DHCP Server Identifier option if set to true.
+ // Enabling this will cause Kea to accept any query even
+ // if the address in the option belongs to another server
+ // instead of dropping it. This config option defaults to
+ // false, as enabling it breaks RFC compliance.
+ "ignore-dhcp-server-identifier": false,
+
// Ignore Relay Agent Information Link Selection suboption if set
// to true. Enabling this will cause Kea use normal subnet
// selection logic instead of attempting to use the subnet
In the example above, the ``domain-name-servers`` option respects the global
-``always-send`` flag and is always added to responses, but for subnet
-``192.0.3.0/24``, the value is taken from the subnet-level option data
+``always-send`` flag and is always added to responses, but for subnet
+``192.0.3.0/24``, the value is taken from the subnet-level option data
specification.
At the opposite of ``always-send`` if the ``never-send`` flag is set to
}
}
+Ignore DHCP Server Identifier
+-----------------------------
+
+With ``"ignore-dhcp-server-identifier": true``, the server does not check the
+address in the DHCP Server Identifier option i.e. whether a query is sent
+to this server or another one (and in the second case dropping the query).
+
+.. code-block:: json
+
+ {
+ "Dhcp4": {
+ "compatibility": {
+ "ignore-dhcp-server-identifier": true
+ }
+ }
+ }
+
+
Ignore RAI Link Selection
-------------------------
}
}
+ // Skip address check if configured to ignore the server id.
+ SrvConfigPtr cfg = CfgMgr::instance().getCurrentCfg();
+ if (cfg->getIgnoreServerIdentifier()) {
+ return (true);
+ }
+
// This function iterates over all interfaces on which the
// server is listening to find the one which has a socket bound
// to the address carried in the server identifier option.
/// know the reservations for the client communicating with the server.
/// We may revise some of these choices in the future.
- SrvConfigPtr cfg = CfgMgr::instance().getCurrentCfg();
-
// Check if there is at least one subnet configured with this server
// identifier.
ConstCfgSubnets4Ptr cfg_subnets = cfg->getCfgSubnets4();
if (kv.first == "lenient-option-parsing") {
CfgMgr::instance().getStagingCfg()->setLenientOptionParsing(
kv.second->boolValue());
+ } else if (kv.first == "ignore-dhcp-server-identifier") {
+ CfgMgr::instance().getStagingCfg()->setIgnoreServerIdentifier(
+ kv.second->boolValue());
} else if (kv.first == "ignore-rai-link-selection") {
CfgMgr::instance().getStagingCfg()->setIgnoreRAILinkSelection(
kv.second->boolValue());
"\"renew-timer\": 1000, "
"\"compatibility\": { "
" \"lenient-option-parsing\": true,"
+ " \"ignore-dhcp-server-identifier\": true,"
" \"ignore-rai-link-selection\": true,"
" \"exclude-first-last-24\": true"
"},"
// Check defaults: they should be false.
EXPECT_FALSE(CfgMgr::instance().getStagingCfg()->getLenientOptionParsing());
+ EXPECT_FALSE(CfgMgr::instance().getStagingCfg()->getIgnoreServerIdentifier());
EXPECT_FALSE(CfgMgr::instance().getStagingCfg()->getIgnoreRAILinkSelection());
EXPECT_FALSE(CfgMgr::instance().getStagingCfg()->getExcludeFirstLast24());
checkResult(status, 0);
EXPECT_TRUE(CfgMgr::instance().getStagingCfg()->getLenientOptionParsing());
+ EXPECT_TRUE(CfgMgr::instance().getStagingCfg()->getIgnoreServerIdentifier());
EXPECT_TRUE(CfgMgr::instance().getStagingCfg()->getIgnoreRAILinkSelection());
EXPECT_TRUE(CfgMgr::instance().getStagingCfg()->getExcludeFirstLast24());
}
"{\n"
" \"compatibility\": {\n"
" \"exclude-first-last-24\": true,\n"
+" \"ignore-dhcp-server-identifier\": true,\n"
" \"ignore-rai-link-selection\": true,\n"
" \"lenient-option-parsing\": true\n"
" },\n"
" \"calculate-tee-times\": false,\n"
" \"compatibility\": {\n"
" \"exclude-first-last-24\": true,\n"
+" \"ignore-dhcp-server-identifier\": true,\n"
" \"ignore-rai-link-selection\": true,\n"
" \"lenient-option-parsing\": true\n"
" },\n"
decline_timer_(0), echo_v4_client_id_(true), dhcp4o6_port_(0),
d2_client_config_(new D2ClientConfig()),
configured_globals_(new CfgGlobals()), cfg_consist_(new CfgConsistency()),
- lenient_option_parsing_(false), ignore_rai_link_selection_(false),
- exclude_first_last_24_(false), reservations_lookup_first_(false) {
+ lenient_option_parsing_(false), ignore_dhcp_server_identifier_(false),
+ ignore_rai_link_selection_(false), exclude_first_last_24_(false),
+ reservations_lookup_first_(false) {
}
SrvConfig::SrvConfig(const uint32_t sequence)
decline_timer_(0), echo_v4_client_id_(true), dhcp4o6_port_(0),
d2_client_config_(new D2ClientConfig()),
configured_globals_(new CfgGlobals()), cfg_consist_(new CfgConsistency()),
- lenient_option_parsing_(false), ignore_rai_link_selection_(false),
- exclude_first_last_24_(false), reservations_lookup_first_(false) {
+ lenient_option_parsing_(false), ignore_dhcp_server_identifier_(false),
+ ignore_rai_link_selection_(false), exclude_first_last_24_(false),
+ reservations_lookup_first_(false) {
}
std::string
if (getLenientOptionParsing()) {
compatibility->set("lenient-option-parsing", Element::create(true));
}
+ if (getIgnoreServerIdentifier()) {
+ compatibility->set("ignore-dhcp-server-identifier", Element::create(true));
+ }
if (getIgnoreRAILinkSelection()) {
compatibility->set("ignore-rai-link-selection", Element::create(true));
}
return lenient_option_parsing_;
}
+ /// @brief Set ignore DHCP Server Identifier compatibility flag.
+ ///
+ /// @param value the boolean value to be set when configuring DHCP
+ /// Server Identifier usage preferences.
+ void setIgnoreServerIdentifier(bool const value) {
+ ignore_dhcp_server_identifier_ = value;
+ }
+
+ /// @brief Get ignore DHCP Server Identifier compatibility flag.
+ ///
+ /// @return the configured value for DHCP Server Identifier usage preferences.
+ bool getIgnoreServerIdentifier() const {
+ return (ignore_dhcp_server_identifier_);
+ }
+
/// @brief Set ignore RAI Link Selection compatibility flag.
///
/// @param value the boolean value to be set when configuring RAI Link
//@{
/// @brief Indicates whether lenient option parsing is enabled
bool lenient_option_parsing_;
+ /// @brief Indicates whether DHCP server identifier option will be ignored
+ bool ignore_dhcp_server_identifier_;
/// @brief Indicates whether RAI link-selection suboptions will be ignored
bool ignore_rai_link_selection_;
/// @brief Indicates whether exclude .0 .255 from subnets bigger than /24.
// Check that defaults are false.
EXPECT_FALSE(conf.getLenientOptionParsing());
+ EXPECT_FALSE(conf.getIgnoreServerIdentifier());
EXPECT_FALSE(conf.getIgnoreRAILinkSelection());
EXPECT_FALSE(conf.getExcludeFirstLast24());
// Check that they can be modified to true.
conf.setLenientOptionParsing(true);
+ conf.setIgnoreServerIdentifier(true);
conf.setIgnoreRAILinkSelection(true);
conf.setExcludeFirstLast24(true);
EXPECT_TRUE(conf.getLenientOptionParsing());
+ EXPECT_TRUE(conf.getIgnoreServerIdentifier());
EXPECT_TRUE(conf.getIgnoreRAILinkSelection());
EXPECT_TRUE(conf.getExcludeFirstLast24());
// Check that default values can be restored.
conf.setLenientOptionParsing(false);
+ conf.setIgnoreServerIdentifier(false);
conf.setIgnoreRAILinkSelection(false);
conf.setExcludeFirstLast24(false);
EXPECT_FALSE(conf.getLenientOptionParsing());
+ EXPECT_FALSE(conf.getIgnoreServerIdentifier());
EXPECT_FALSE(conf.getIgnoreRAILinkSelection());
EXPECT_FALSE(conf.getExcludeFirstLast24());
// Check the other constructor has the same default.
SrvConfig conf1(1);
EXPECT_FALSE(conf1.getLenientOptionParsing());
+ EXPECT_FALSE(conf.getIgnoreServerIdentifier());
EXPECT_FALSE(conf1.getIgnoreRAILinkSelection());
EXPECT_FALSE(conf1.getExcludeFirstLast24());
}