// 'udp' is generally better if you have only relayed traffic. Kea
// than opens up normal UDP socket and the kernel does all the
// Ethernet/IP stack processing.
- "dhcp-socket-type": "udp"
+ "dhcp-socket-type": "udp",
+
+ // This makes interfaces to be re-detected at each (re-)configuration.
+ // By default it is true.
+ "re-detect": true
},
// We need to specify the the database used to store leases. As of
{
// Kea is told to listen on ethX network interface only.
"interfaces-config": {
- "interfaces": [ "ethX" ]
+ "interfaces": [ "ethX" ],
+
+ // This makes interfaces to be re-detected at each (re-)configuration.
+ // By default it is true.
+ "re-detect": true
},
// We need to specify the the database used to store leases. As of
}
}
+\"re-detect\" {
+ switch(driver.ctx_) {
+ case isc::dhcp::Parser4Context::INTERFACES_CONFIG:
+ return isc::dhcp::Dhcp4Parser::make_RE_DETECT(driver.loc_);
+ default:
+ return isc::dhcp::Dhcp4Parser::make_STRING("re-detect", driver.loc_);
+ }
+}
+
\"lease-database\" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::DHCP4:
DHCP_SOCKET_TYPE "dhcp-socket-type"
RAW "raw"
UDP "udp"
+ RE_DETECT "re-detect"
ECHO_CLIENT_ID "echo-client-id"
MATCH_CLIENT_ID "match-client-id"
interfaces_config_param: interfaces_list
| dhcp_socket_type
+ | re_detect
;
sub_interfaces4: LCURLY_BRACKET {
| UDP { $$ = ElementPtr(new StringElement("udp", ctx.loc2pos(@1))); }
;
+re_detect: RE_DETECT COLON BOOLEAN {
+ ElementPtr b(new BoolElement($3, ctx.loc2pos(@3)));
+ ctx.stack_.back()->set("re-detect", b);
+};
+
+
lease_database: LEASE_DATABASE {
ElementPtr i(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("lease-database", i);
}
}
+\"re-detect\" {
+ switch(driver.ctx_) {
+ case isc::dhcp::Parser6Context::INTERFACES_CONFIG:
+ return isc::dhcp::Dhcp6Parser::make_RE_DETECT(driver.loc_);
+ default:
+ return isc::dhcp::Dhcp6Parser::make_STRING("re-detect", driver.loc_);
+ }
+}
+
\"lease-database\" {
switch(driver.ctx_) {
case isc::dhcp::Parser6Context::DHCP6:
DHCP6 "Dhcp6"
INTERFACES_CONFIG "interfaces-config"
INTERFACES "interfaces"
+ RE_DETECT "re-detect"
LEASE_DATABASE "lease-database"
HOSTS_DATABASE "hosts-database"
ctx.stack_.back()->set("interfaces-config", i);
ctx.stack_.push_back(i);
ctx.enter(ctx.INTERFACES_CONFIG);
-} COLON LCURLY_BRACKET interface_config_map RCURLY_BRACKET {
+} COLON LCURLY_BRACKET interfaces_config_params RCURLY_BRACKET {
ctx.stack_.pop_back();
ctx.leave();
};
// Parse the interfaces-config map
ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.push_back(m);
-} interface_config_map RCURLY_BRACKET {
+} interfaces_config_params RCURLY_BRACKET {
// parsing completed
};
-interface_config_map: INTERFACES {
+interfaces_config_params: interfaces_config_param
+ | interfaces_config_params COMMA interfaces_config_param
+ ;
+
+interfaces_config_param: interfaces_list
+ | re_detect
+ ;
+
+interfaces_list: INTERFACES {
ElementPtr l(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("interfaces", l);
ctx.stack_.push_back(l);
ctx.leave();
};
+re_detect: RE_DETECT COLON BOOLEAN {
+ ElementPtr b(new BoolElement($3, ctx.loc2pos(@3)));
+ ctx.stack_.back()->set("re-detect", b);
+};
+
+
lease_database: LEASE_DATABASE {
ElementPtr i(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("lease-database", i);
-// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015,2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
void
IfacesConfigParser::parseInterfacesList(const CfgIfacePtr& cfg_iface,
- ConstElementPtr ifaces_list) {
+ ConstElementPtr ifaces_list) {
BOOST_FOREACH(ConstElementPtr iface, ifaces_list->listValue()) {
std::string iface_name = iface->stringValue();
try {
bool socket_type_specified = false;
BOOST_FOREACH(ConfigPair element, ifaces_config->mapValue()) {
try {
+ // Check for re-detect before calling parseInterfacesList()
+ if (element.first == "re-detect") {
+ if (element.second->boolValue()) {
+ IfaceMgr::instance().clearIfaces();
+ IfaceMgr::instance().detectIfaces();
+ }
+ continue;
+ }
+
if (element.first == "interfaces") {
parseInterfacesList(cfg, element.second);
continue;