mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-10-07 13:36:21 +00:00
[3797] Added support for Control Channel to DHCPv6
src/bin/dhcp6/ctrl_dhcp6_srv.cc ControlledDhcpv6Srv::ControlledDhcpv6Srv() added CommandMgr init and handler registration ControlledDhcpv6Srv::~ControlledDhcpv6Srv() { added CommandMgr shutdown and handler deregistration src/bin/dhcp6/json_config_parser.cc - createGlobal6DhcpConfigParser() added support for "control-socket" element - configureDhcp6Server() added logic to configure CommandMgr based on control-socket configuration element src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc - UnixControlClient - new class that acts as UnixCommandSocket client - CtrlChannelDhcpv6SrvTest - new test fixture for testing a DHCPv6 server with a Control Channel - Added the following tests: TEST_F(CtrlDhcpv6SrvTest, commandsRegistration) TEST_F(CtrlChannelDhcpv6SrvTest, controlChannelNegative) TEST_F(CtrlChannelDhcpv6SrvTest, controlChannelShutdown) TEST_F(CtrlChannelDhcpv6SrvTest, controlChannelStats)
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include <asiolink/io_address.h>
|
||||
#include <cc/data.h>
|
||||
#include <cc/command_interpreter.h>
|
||||
#include <config/command_mgr.h>
|
||||
#include <dhcp/libdhcp++.h>
|
||||
#include <dhcp6/json_config_parser.h>
|
||||
#include <dhcp6/dhcp6_log.h>
|
||||
@@ -693,6 +694,8 @@ namespace dhcp {
|
||||
globalContext());
|
||||
} else if (config_id.compare("relay-supplied-options") == 0) {
|
||||
parser = new RSOOListConfigParser(config_id);
|
||||
} else if (config_id.compare("control-socket") == 0) {
|
||||
parser = new ControlSocketParser(config_id);
|
||||
} else {
|
||||
isc_throw(DhcpConfigError,
|
||||
"unsupported global configuration parameter: "
|
||||
@@ -815,6 +818,26 @@ configureDhcp6Server(Dhcpv6Srv&, isc::data::ConstElementPtr config_set) {
|
||||
subnet_parser->build(subnet_config->second);
|
||||
}
|
||||
|
||||
// Get command socket configuration from the config file.
|
||||
// This code expects the following structure:
|
||||
// {
|
||||
// "socket-type": "unix",
|
||||
// "socket-name": "/tmp/kea6.sock"
|
||||
// }
|
||||
ConstElementPtr sock_cfg =
|
||||
CfgMgr::instance().getStagingCfg()->getControlSocketInfo();
|
||||
|
||||
// Close existing socket (if any).
|
||||
isc::config::CommandMgr::instance().closeCommandSocket();
|
||||
if (sock_cfg) {
|
||||
// This will create a control socket and will install external socket
|
||||
// in IfaceMgr. That socket will be monitored when Dhcp4Srv::receivePacket()
|
||||
// calls IfaceMgr::receive4() and callback in CommandMgr will be called,
|
||||
// if necessary. If there were previously open command socket, it will
|
||||
// be closed.
|
||||
isc::config::CommandMgr::instance().openCommandSocket(sock_cfg);
|
||||
}
|
||||
|
||||
// The lease database parser is the last to be run.
|
||||
std::map<std::string, ConstElementPtr>::const_iterator leases_config =
|
||||
values_map.find("lease-database");
|
||||
|
Reference in New Issue
Block a user