]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Merge branch 'trac3399' [Kea4 reads config from JSON file]
authorTomek Mrugalski <tomasz@isc.org>
Mon, 2 Jun 2014 17:44:33 +0000 (19:44 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Mon, 2 Jun 2014 17:44:33 +0000 (19:44 +0200)
Conflicts:
ChangeLog
src/bin/dhcp6/kea_controller.cc
src/lib/dhcpsrv/daemon.h

1  2 
ChangeLog
doc/devel/mainpage.dox
src/bin/dhcp4/tests/d2_unittest.cc
src/bin/dhcp6/bundy_controller.cc
src/bin/dhcp6/dhcp6.dox
src/bin/dhcp6/dhcp6_messages.mes
src/bin/dhcp6/kea_controller.cc
src/lib/dhcpsrv/daemon.h

diff --cc ChangeLog
index d5d21682227c8c7c5aa0e84c55cbe4c010cdf530,bb12ba4ff1459289599a6d6efcc632c6dcdf26fe..d2ee0fe72594c4c5535bac188790ae1e820a5cd0
+++ b/ChangeLog
@@@ -1,27 -1,9 +1,34 @@@
 -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"
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 3c8135c8a1ba6b09c02ea6ae31a8315d675e06c9,cd099009d67e20280baccce87e9810f7a182eed0..33404cac58b3169535a6dd73885f0915c6d7e084
  #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
index 52623f0ff3061fe0faa02feabdc7ded650c7df28,9bcbf7f80e081b39981998c0ac9de97c73927393..515b168b6f8f07374ee80caa375616587b1ba71a
@@@ -93,20 -83,14 +93,24 @@@ public
      /// 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