Commit 45d78a3d authored by Marcin Siodelski's avatar Marcin Siodelski

[3874] Use generated server identifier in the server.

parent 93a91c8a
......@@ -28,6 +28,13 @@ using namespace isc::hooks;
using namespace isc::stats;
using namespace std;
namespace {
// Name of the file holding server identifier.
static const char* SERVER_DUID_FILE = "kea-dhcp6-serverid";
namespace isc {
namespace dhcp {
......@@ -173,6 +180,24 @@ ControlledDhcpv6Srv::processConfig(isc::data::ConstElementPtr config) {
+ string(ex.what())));
// Regenerate server identifier if needed.
try {
const std::string duid_file = CfgMgr::instance().getDataDir() + "/" +
DuidPtr duid = CfgMgr::instance().getStagingCfg()->getCfgDUID()->create(duid_file);
server_->serverid_.reset(new Option(Option::V6, D6O_SERVERID, duid->getDuid()));
if (duid) {
} catch (const std::exception& ex) {
std::ostringstream err;
err << "unable to configure server identifier: " << ex.what();
return (isc::config::createAnswer(1, err.str()));
// Server will start DDNS communications if its enabled.
try {
......@@ -184,7 +184,7 @@ const std::string Dhcpv6Srv::VENDOR_CLASS_PREFIX("VENDOR_CLASS_");
static const char* SERVER_DUID_FILE = "kea-dhcp6-serverid";
Dhcpv6Srv::Dhcpv6Srv(uint16_t port)
: serverid_(), port_(port), shutdown_(true), alloc_engine_()
: port_(port), serverid_(), shutdown_(true), alloc_engine_()
LOG_DEBUG(dhcp6_logger, DBG_DHCP6_START, DHCP6_OPEN_SOCKET).arg(port);
......@@ -203,9 +203,6 @@ Dhcpv6Srv::Dhcpv6Srv(uint16_t port)
DUIDFactory duid_factory(duid_file);
DuidPtr duid = duid_factory.get();
serverid_.reset(new Option(Option::V6, D6O_SERVERID, duid->getDuid()));
// Instantiate allocation engine. The number of allocation attempts equal
// to zero indicates that the allocation engine will use the number of
......@@ -760,14 +760,14 @@ private:
/// @param query packet transmitted
static void processStatsSent(const Pkt6Ptr& response);
/// Server DUID (to be sent in server-identifier option)
OptionPtr serverid_;
/// UDP port number on which server listens.
uint16_t port_;
/// Server DUID (to be sent in server-identifier option)
OptionPtr serverid_;
/// Indicates if shutdown is in progress. Setting it to true will
/// initiate server shutdown procedure.
volatile bool shutdown_;
......@@ -39,6 +39,19 @@ of active interfaces. This doesn't prevent the server from listening to
the DHCP traffic through open sockets, but will rather be used by Interface
Manager to select active interfaces when sockets are re-opened.
% DHCPSRV_CFGMGR_CONFIGURE_SERVERID server configuration includes specification of a server identifier
This warning message is issued when the server specified configuration of
a server identifier. If this new configuration overrides an existing
server identifier, this will affect existing bindings of the clients.
Clients will use old server identifier when they renew their bindings.
The server will not respond to those renews, and the clients will
eventually transition to rebinding state. The server should reassign
existing bindings and the clients will subsequently use new server
identifier. It is recommended to not modify the server identifier, unless
there is a good reason for it, to avoid increased number of renewals and
a need for rebinding (increase of multicast traffic, which may be received
by multiple servers).
% DHCPSRV_CFGMGR_NO_SUBNET4 no suitable subnet is defined for address hint %1
This debug message is output when the DHCP configuration manager has received
a request for an IPv4 subnet for the specified address, but no such
......@@ -17,6 +17,7 @@
#include <dhcp/duid.h>
#include <dhcpsrv/cfg_duid.h>
#include <dhcpsrv/cfgmgr.h>
#include <dhcpsrv/dhcpsrv_log.h>
#include <dhcpsrv/parsers/duid_config_parser.h>
#include <exceptions/exceptions.h>
#include <boost/foreach.hpp>
......@@ -66,6 +67,8 @@ DUIDConfigParser::build(isc::data::ConstElementPtr duid_configuration) {
" for the DUID configuration ("
<< duid_configuration->getPosition() << ")");
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment