"compatibility": {
// Parse options more leniently where fields can be deduced
// deterministically even if against RFC or common practice.
- "lenient-option-parsing": true
+ "lenient-option-parsing": true,
+ // Ignore Relay Agent Information Link Selection suboption if set
+ // to true. This will use normal subnet selection logic instead of
+ // attempting to use the subnet specified by the suboption.
+ "ignore-rai-link-selection": false
},
// Command control socket configuration parameters for Kea DHCPv4 server.
"compatibility": {
// Parse options more leniently where fields can be deduced
// deterministically even if against RFC or common practice.
- "lenient-option-parsing": true
+ "lenient-option-parsing": true,
+ // Ignore Relay Agent Information Link Selection suboption if set
+ // to true. This will use normal subnet selection logic instead of
+ // attempting to use the subnet specified by the suboption.
+ "ignore-rai-link-selection": false
},
// Command control socket configuration parameters for Kea DHCPv4 server.
| compatibility_params "," compatibility_param
| compatibility_params ","
- compatibility_param ::= lenient_option_parsing
+ compatibility_param ::= lenient_option_parsing | ignore-rai-link-selection |
| unknown_map_entry
lenient_option_parsing ::= "lenient-option-parsing" ":" BOOLEAN
+ ignore-rai-link-selection ::= "ignore-rai-link-selection" ":" BOOLEAN
+
;
compatibility_param: lenient_option_parsing
+ | ignore-rai-link-selection
| unknown_map_entry
;
ctx.stack_.back()->set("lenient-option-parsing", b);
};
+ignore-rai-link-selection: IGNORE_RAI_LINK_SEL COLON BOOLEAN {
+ ctx.unique("ignore-rai-link-selection", ctx.loc2pos(@1));
+ ElementPtr b(new BoolElement($3, ctx.loc2pos(@3)));
+ ctx.stack_.back()->set("lenient-option-parsing", b);
+}
+
%%
void
CfgMgr::instance().getStagingCfg()->setLenientOptionParsing(
kv.second->boolValue());
}
+ if (kv.first == "ignore-rai-link-selection") {
+ CfgMgr::instance().getStagingCfg()->setIgnoreRAILinkSelection(
+ kv.second->boolValue());
+ }
}
}
#include <config.h>
#include <dhcp/iface_mgr.h>
#include <dhcp/option_custom.h>
+#include <dhcpsrv/cfgmgr.h>
#include <dhcpsrv/cfg_subnets4.h>
#include <dhcpsrv/dhcpsrv_log.h>
#include <dhcpsrv/lease_mgr_factory.h>
OptionCustomPtr rai_custom =
boost::dynamic_pointer_cast<OptionCustom>(rai);
if (rai_custom) {
- OptionPtr link_select =
- rai_custom->getOption(RAI_OPTION_LINK_SELECTION);
- if (link_select) {
- OptionBuffer link_select_buf = link_select->getData();
- if (link_select_buf.size() == sizeof(uint32_t)) {
- selector.option_select_ =
- IOAddress::fromBytes(AF_INET, &link_select_buf[0]);
- return (selector);
+ // If Relay Agent Information Link Selection is ignored in the configuration, skip
+ // returning the related subnet selector here, and move on to normal subnet selection.
+ bool ignore_link_sel = CfgMgr::instance().getCurrentCfg()->getIgnoreRAILinkSelection();
+ if (!ignore_link_sel) {
+ OptionPtr link_select =
+ rai_custom->getOption(RAI_OPTION_LINK_SELECTION);
+ if (link_select) {
+ OptionBuffer link_select_buf = link_select->getData();
+ if (link_select_buf.size() == sizeof(uint32_t)) {
+ selector.option_select_ =
+ IOAddress::fromBytes(AF_INET, &link_select_buf[0]);
+ return (selector);
+ }
}
}
}
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), reservations_lookup_first_(false) {
+ lenient_option_parsing_(false), ignore_rai_link_selection_(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), reservations_lookup_first_(false) {
+ lenient_option_parsing_(false), ignore_rai_link_selection_(false),
+ reservations_lookup_first_(false) {
}
std::string
return lenient_option_parsing_;
}
+ /// @brief Set ignore RAI Link Selection compatibility flag.
+ ///
+ /// @param value the boolean value to be set when configuring RAI Link
+ /// Selection usage preferences
+ void setIgnoreRAILinkSelection(bool const value) {
+ ignore_rai_link_selection_ = value;
+ }
+
+ /// @brief Get ignore RAI Link Selection compatibility flag.
+ ///
+ /// @return the configured value for RAI Link Selection usage preferences
+ bool getIgnoreRAILinkSelection() const {
+ return ignore_rai_link_selection_;
+ }
+
/// @brief Convenience method to propagate configuration parameters through
/// inversion of control.
///
/// @brief Compatibility flags
/// @{
bool lenient_option_parsing_;
+ bool ignore_rai_link_selection_;
/// @}
/// @brief Flag which indicates if the server should do host reservations