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 {
+ string(ex.what())));
}
+ // Regenerate server identifier if needed.
+ try {
+ const std::string duid_file = CfgMgr::instance().getDataDir() + "/" +
+ std::string(SERVER_DUID_FILE);
+ DuidPtr duid = CfgMgr::instance().getStagingCfg()->getCfgDUID()->create(duid_file);
+ server_->serverid_.reset(new Option(Option::V6, D6O_SERVERID, duid->getDuid()));
+ if (duid) {
+ LOG_INFO(dhcp6_logger, DHCP6_USING_SERVERID)
+ .arg(duid->toText())
+ .arg(duid_file);
+ }
+
+ } 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 {
srv->startD2();
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);
DUIDFactory duid_factory(duid_file);
DuidPtr duid = duid_factory.get();
serverid_.reset(new Option(Option::V6, D6O_SERVERID, duid->getDuid()));
- LOG_INFO(dhcp6_logger, DHCP6_USING_SERVERID)
- .arg(duidToString(getServerID()))
- .arg(duid_file);
// Instantiate allocation engine. The number of allocation attempts equal
// to zero indicates that the allocation engine will use the number of
/// @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_;
protected:
+ /// 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_;
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
#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>
" for the DUID configuration ("
<< duid_configuration->getPosition() << ")");
}
+
+ LOG_WARN(dhcpsrv_logger, DHCPSRV_CFGMGR_CONFIGURE_SERVERID);
}
void