mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 21:45:37 +00:00
[#2543] Add RAI Link Selection preferences
This commit is contained in:
@@ -105,7 +105,11 @@
|
|||||||
"compatibility": {
|
"compatibility": {
|
||||||
// Parse options more leniently where fields can be deduced
|
// Parse options more leniently where fields can be deduced
|
||||||
// deterministically even if against RFC or common practice.
|
// 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.
|
// Command control socket configuration parameters for Kea DHCPv4 server.
|
||||||
|
@@ -105,7 +105,11 @@
|
|||||||
"compatibility": {
|
"compatibility": {
|
||||||
// Parse options more leniently where fields can be deduced
|
// Parse options more leniently where fields can be deduced
|
||||||
// deterministically even if against RFC or common practice.
|
// 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.
|
// Command control socket configuration parameters for Kea DHCPv4 server.
|
||||||
|
@@ -990,8 +990,10 @@ This grammar is generated from ``dhcp4_parser.yy``. See :ref:`dhcp4` for more de
|
|||||||
| compatibility_params "," compatibility_param
|
| compatibility_params "," compatibility_param
|
||||||
| compatibility_params ","
|
| compatibility_params ","
|
||||||
|
|
||||||
compatibility_param ::= lenient_option_parsing
|
compatibility_param ::= lenient_option_parsing | ignore-rai-link-selection |
|
||||||
| unknown_map_entry
|
| unknown_map_entry
|
||||||
|
|
||||||
lenient_option_parsing ::= "lenient-option-parsing" ":" BOOLEAN
|
lenient_option_parsing ::= "lenient-option-parsing" ":" BOOLEAN
|
||||||
|
|
||||||
|
ignore-rai-link-selection ::= "ignore-rai-link-selection" ":" BOOLEAN
|
||||||
|
|
||||||
|
@@ -2847,6 +2847,7 @@ compatibility_params: compatibility_param
|
|||||||
;
|
;
|
||||||
|
|
||||||
compatibility_param: lenient_option_parsing
|
compatibility_param: lenient_option_parsing
|
||||||
|
| ignore-rai-link-selection
|
||||||
| unknown_map_entry
|
| unknown_map_entry
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -2856,6 +2857,12 @@ lenient_option_parsing: LENIENT_OPTION_PARSING COLON BOOLEAN {
|
|||||||
ctx.stack_.back()->set("lenient-option-parsing", b);
|
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
|
void
|
||||||
|
@@ -598,6 +598,10 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
|
|||||||
CfgMgr::instance().getStagingCfg()->setLenientOptionParsing(
|
CfgMgr::instance().getStagingCfg()->setLenientOptionParsing(
|
||||||
kv.second->boolValue());
|
kv.second->boolValue());
|
||||||
}
|
}
|
||||||
|
if (kv.first == "ignore-rai-link-selection") {
|
||||||
|
CfgMgr::instance().getStagingCfg()->setIgnoreRAILinkSelection(
|
||||||
|
kv.second->boolValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <dhcp/iface_mgr.h>
|
#include <dhcp/iface_mgr.h>
|
||||||
#include <dhcp/option_custom.h>
|
#include <dhcp/option_custom.h>
|
||||||
|
#include <dhcpsrv/cfgmgr.h>
|
||||||
#include <dhcpsrv/cfg_subnets4.h>
|
#include <dhcpsrv/cfg_subnets4.h>
|
||||||
#include <dhcpsrv/dhcpsrv_log.h>
|
#include <dhcpsrv/dhcpsrv_log.h>
|
||||||
#include <dhcpsrv/lease_mgr_factory.h>
|
#include <dhcpsrv/lease_mgr_factory.h>
|
||||||
@@ -224,14 +225,19 @@ CfgSubnets4::initSelector(const Pkt4Ptr& query) {
|
|||||||
OptionCustomPtr rai_custom =
|
OptionCustomPtr rai_custom =
|
||||||
boost::dynamic_pointer_cast<OptionCustom>(rai);
|
boost::dynamic_pointer_cast<OptionCustom>(rai);
|
||||||
if (rai_custom) {
|
if (rai_custom) {
|
||||||
OptionPtr link_select =
|
// If Relay Agent Information Link Selection is ignored in the configuration, skip
|
||||||
rai_custom->getOption(RAI_OPTION_LINK_SELECTION);
|
// returning the related subnet selector here, and move on to normal subnet selection.
|
||||||
if (link_select) {
|
bool ignore_link_sel = CfgMgr::instance().getCurrentCfg()->getIgnoreRAILinkSelection();
|
||||||
OptionBuffer link_select_buf = link_select->getData();
|
if (!ignore_link_sel) {
|
||||||
if (link_select_buf.size() == sizeof(uint32_t)) {
|
OptionPtr link_select =
|
||||||
selector.option_select_ =
|
rai_custom->getOption(RAI_OPTION_LINK_SELECTION);
|
||||||
IOAddress::fromBytes(AF_INET, &link_select_buf[0]);
|
if (link_select) {
|
||||||
return (selector);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -47,7 +47,8 @@ SrvConfig::SrvConfig()
|
|||||||
decline_timer_(0), echo_v4_client_id_(true), dhcp4o6_port_(0),
|
decline_timer_(0), echo_v4_client_id_(true), dhcp4o6_port_(0),
|
||||||
d2_client_config_(new D2ClientConfig()),
|
d2_client_config_(new D2ClientConfig()),
|
||||||
configured_globals_(new CfgGlobals()), cfg_consist_(new CfgConsistency()),
|
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)
|
SrvConfig::SrvConfig(const uint32_t sequence)
|
||||||
@@ -65,7 +66,8 @@ SrvConfig::SrvConfig(const uint32_t sequence)
|
|||||||
decline_timer_(0), echo_v4_client_id_(true), dhcp4o6_port_(0),
|
decline_timer_(0), echo_v4_client_id_(true), dhcp4o6_port_(0),
|
||||||
d2_client_config_(new D2ClientConfig()),
|
d2_client_config_(new D2ClientConfig()),
|
||||||
configured_globals_(new CfgGlobals()), cfg_consist_(new CfgConsistency()),
|
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
|
std::string
|
||||||
|
@@ -984,6 +984,21 @@ public:
|
|||||||
return lenient_option_parsing_;
|
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
|
/// @brief Convenience method to propagate configuration parameters through
|
||||||
/// inversion of control.
|
/// inversion of control.
|
||||||
///
|
///
|
||||||
@@ -1148,6 +1163,7 @@ private:
|
|||||||
/// @brief Compatibility flags
|
/// @brief Compatibility flags
|
||||||
/// @{
|
/// @{
|
||||||
bool lenient_option_parsing_;
|
bool lenient_option_parsing_;
|
||||||
|
bool ignore_rai_link_selection_;
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/// @brief Flag which indicates if the server should do host reservations
|
/// @brief Flag which indicates if the server should do host reservations
|
||||||
|
Reference in New Issue
Block a user