-7XX. [func] tomek
++788. [func] tomek
+ DHCPv4 server: New parameter added to configure.ac: --with-kea-config.
+ It allows selecting configuration backend and accepts one of two
+ values: BUNDY, which uses Bundy (former BIND10) framework as Kea
+ 0.8 did, or JSON, which reads configuration from a JSON file.
- (Trac #3399, git TBD)
++ (Trac #3399, git 6e4dd3ae58c091ba0fd64c87fa8d7c268210f99b)
++
+787. [func] marcin
+ DHCPv6 server: Implemented dynamic reconfiguration of the server,
+ triggered when the SIGHUP signal is received by the server's
+ process. Also, server performs a graceful shut down when SIGINT
+ or SIGTERM signal is received.
+ (Trac #3406, git 3be60fa6ac521aecae6ae92d26dc03792bc76903)
+
+786. [func] tmark
+ DHCP-DDNS now supports DDNS updates with TSIG. Please refer to the
+ Kea Guide for details. Prior to this TSIG keys could be defined but
+ were not used.
+ (Trac #3432, git 80fea12a53d1e832d4e7b710ca6ea613300f73ea)
+
+785. [bug] marcin
+ DHCPv6 server avoids collisions between prefixes that are allocated
+ as a result of receiving hints from the clients. Previously the
+ whole prefix (including bits beyond the prefix length) was used to
+ search existing leases in the lease database. If not found, the
+ new lease was crated for the prefix sent by the client. If another
+ client sent the same prefix but with different non-significant bits
+ the prefix was allocated. This led to prefix collisions. Currently,
+ server ignores bits beyond the prefix length when searching for
+ existing leases.
+ (Trac #3246, git 50de7df4195195e981ae9c8c6f1b4100047d5bb5)
784. [func] tmark
DHCP_DDNS's configuration was changed. The unused parameter, "interface"
#include <dhcp6/json_config_parser.h>
#include <dhcp6/ctrl_dhcp6_srv.h>
#include <dhcp6/dhcp6_log.h>
- #include <dhcp6/spec_config.h>
- #include <log/logger_level.h>
- #include <log/logger_name.h>
- #include <log/logger_manager.h>
- #include <log/logger_specification.h>
- #include <log/logger_support.h>
- #include <log/output_option.h>
#include <exceptions/exceptions.h>
- #include <util/buffer.h>
- #include <cassert>
- #include <iostream>
+#include <signal.h>
++
#include <string>
- #include <vector>
using namespace isc::asiolink;
- using namespace isc::cc;
- using namespace isc::config;
- using namespace isc::data;
using namespace isc::dhcp;
- using namespace isc::log;
- using namespace isc::util;
using namespace std;
-namespace isc {
-namespace dhcp {
-
-void
-ControlledDhcpv6Srv::init(const std::string& file_name) {
+namespace {
+
+/// @brief Configure DHCPv6 server using the configuration file specified.
+///
+/// This function is used to both configure the DHCP server on its startup
+/// and dynamically reconfigure the server when SIGHUP signal is received.
+///
+/// It fetches DHCPv6 server's configuration from the 'Dhcp6' section of
+/// the JSON configuration file.
+///
+/// @param file_name Configuration file location.
+void configure(const std::string& file_name) {
// This is a configuration backend implementation that reads the
// configuration from a JSON file.
reason = string(" (") + comment->stringValue() + string(")");
}
LOG_ERROR(dhcp6_logger, DHCP6_CONFIG_LOAD_FAIL).arg(reason);
- isc_throw(BadValue, "Failed to apply configuration:" << reason);
+ isc_throw(isc::BadValue, "Failed to apply configuration:" << reason);
}
- ElementPtr params(new isc::data::MapElement());
+}
+
+/// @brief Signals handler for DHCPv6 server.
+///
+/// This signal handler handles the following signals received by the DHCPv6
+/// server process:
+/// - SIGHUP - triggers server's dynamic reconfiguration.
+/// - SIGTERM - triggers server's shut down.
+/// - SIGINT - triggers server's shut down.
+///
+/// @param signo Signal number received.
+void signalHandler(int signo) {
+ // SIGHUP signals a request to reconfigure the server.
+ if (signo == SIGHUP) {
+ // Get configuration file name.
+ std::string file = ControlledDhcpv6Srv::getInstance()->getConfigFile();
+ try {
+ LOG_INFO(dhcp6_logger, DHCP6_DYNAMIC_RECONFIGURATION).arg(file);
+ configure(file);
+ } catch (const std::exception& ex) {
+ // Log the unsuccessful reconfiguration. The reason for failure
+ // should be already logged. Don't rethrow an exception so as
+ // the server keeps working.
+ LOG_ERROR(dhcp6_logger, DHCP6_DYNAMIC_RECONFIGURATION_FAIL)
+ .arg(file);
+ }
+ } else if ((signo == SIGTERM) || (signo == SIGINT)) {
++ isc::data::ElementPtr params(new isc::data::MapElement());
+ ControlledDhcpv6Srv::processCommand("shutdown", params);
+ }
+}
+
+}
+
+namespace isc {
+namespace dhcp {
+
+void
+ControlledDhcpv6Srv::init(const std::string& file_name) {
+ // Call parent class's init to initialize file name.
+ Daemon::init(file_name);
+
+ // Configure the server using JSON file.
+ configure(file_name);
// We don't need to call openActiveSockets() or startD2() as these
// methods are called in processConfig() which is called by
/// virtual destructor as well.
virtual ~Daemon();
- /// Initializez logger
+ /// @brief Returns config file name.
+ static std::string getConfigFile() {
+ return (config_file_);
+ }
+
+ /// Initializes logger
///
- /// This method initializes logger.
- static void loggerInit(const char* log_name, bool verbose, bool stand_alone);
+ /// This method initializes logger. Currently its implementation is specific
+ /// to each configuration backend.
+ ///
+ /// @param log_name name used in logger initialization
+ /// @param verbose verbose mode (true usually enables DEBUG messages)
+ static void loggerInit(const char* log_name, bool verbose);
+
+private:
+
+ /// @brief Config file name or empty if config file not used.
+ static std::string config_file_;
};
}; // end of isc::dhcp namespace