2014-02-06 20:40:02 +01:00
|
|
|
// Copyright (C) 2012-2014 Internet Systems Consortium, Inc. ("ISC")
|
2012-10-11 19:08:23 +02:00
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice appear in all copies.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
|
|
|
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
|
|
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
|
|
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
|
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
|
|
|
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
// PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
|
|
|
#include <config/ccsession.h>
|
|
|
|
#include <dhcp4/dhcp4_log.h>
|
2012-12-14 12:50:23 +01:00
|
|
|
#include <dhcp/libdhcp++.h>
|
|
|
|
#include <dhcp/option_definition.h>
|
2014-09-22 16:38:14 +02:00
|
|
|
#include <dhcpsrv/cfg_option.h>
|
2012-12-14 12:50:23 +01:00
|
|
|
#include <dhcpsrv/cfgmgr.h>
|
2014-05-21 16:16:18 +02:00
|
|
|
#include <dhcp4/json_config_parser.h>
|
2013-01-11 08:38:05 +00:00
|
|
|
#include <dhcpsrv/dbaccess_parser.h>
|
2013-04-10 17:02:10 -04:00
|
|
|
#include <dhcpsrv/dhcp_parsers.h>
|
2013-01-09 16:18:28 +01:00
|
|
|
#include <dhcpsrv/option_space_container.h>
|
2012-12-14 12:50:23 +01:00
|
|
|
#include <util/encode/hex.h>
|
2012-12-21 13:11:53 +01:00
|
|
|
#include <util/strutil.h>
|
2013-04-10 17:02:10 -04:00
|
|
|
|
2012-12-12 13:02:40 +01:00
|
|
|
#include <boost/foreach.hpp>
|
|
|
|
#include <boost/lexical_cast.hpp>
|
|
|
|
#include <boost/algorithm/string.hpp>
|
2013-04-10 17:02:10 -04:00
|
|
|
|
2012-12-11 18:07:37 +01:00
|
|
|
#include <limits>
|
2012-12-05 15:27:30 +01:00
|
|
|
#include <iostream>
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
|
2012-10-11 19:08:23 +02:00
|
|
|
using namespace std;
|
2012-12-21 12:07:43 +01:00
|
|
|
using namespace isc;
|
|
|
|
using namespace isc::dhcp;
|
2012-10-11 19:08:23 +02:00
|
|
|
using namespace isc::data;
|
|
|
|
using namespace isc::asiolink;
|
|
|
|
|
2012-12-21 12:07:43 +01:00
|
|
|
namespace {
|
|
|
|
|
2013-05-01 07:39:08 -04:00
|
|
|
/// @brief Parser for DHCP4 option data value.
|
2012-10-11 19:08:23 +02:00
|
|
|
///
|
2013-05-01 07:39:08 -04:00
|
|
|
/// This parser parses configuration entries that specify value of
|
|
|
|
/// a single option specific to DHCP4. It provides the DHCP4-specific
|
|
|
|
/// implementation of the abstract class OptionDataParser.
|
|
|
|
class Dhcp4OptionDataParser : public OptionDataParser {
|
2012-10-11 19:08:23 +02:00
|
|
|
public:
|
2013-05-01 07:39:08 -04:00
|
|
|
/// @brief Constructor.
|
2012-10-11 19:08:23 +02:00
|
|
|
///
|
2013-05-01 07:39:08 -04:00
|
|
|
/// @param dummy first param, option names are always "Dhcp4/option-data[n]"
|
|
|
|
/// @param options is the option storage in which to store the parsed option
|
|
|
|
/// upon "commit".
|
2013-07-11 10:34:43 +02:00
|
|
|
/// @param global_context is a pointer to the global context which
|
2013-05-01 07:39:08 -04:00
|
|
|
/// stores global scope parameters, options, option defintions.
|
2013-07-11 10:34:43 +02:00
|
|
|
Dhcp4OptionDataParser(const std::string&,
|
|
|
|
OptionStoragePtr options, ParserContextPtr global_context)
|
2013-05-01 07:39:08 -04:00
|
|
|
:OptionDataParser("", options, global_context) {
|
2012-10-11 19:08:23 +02:00
|
|
|
}
|
|
|
|
|
2013-05-01 07:39:08 -04:00
|
|
|
/// @brief static factory method for instantiating Dhcp4OptionDataParsers
|
2012-10-11 19:08:23 +02:00
|
|
|
///
|
2013-05-06 11:45:27 -04:00
|
|
|
/// @param param_name name of the parameter to be parsed.
|
2013-05-01 07:39:08 -04:00
|
|
|
/// @param options storage where the parameter value is to be stored.
|
2013-07-11 10:34:43 +02:00
|
|
|
/// @param global_context is a pointer to the global context which
|
2013-05-01 07:39:08 -04:00
|
|
|
/// stores global scope parameters, options, option defintions.
|
|
|
|
/// @return returns a pointer to a new OptionDataParser. Caller is
|
|
|
|
/// is responsible for deleting it when it is no longer needed.
|
|
|
|
static OptionDataParser* factory(const std::string& param_name,
|
|
|
|
OptionStoragePtr options, ParserContextPtr global_context) {
|
|
|
|
return (new Dhcp4OptionDataParser(param_name, options, global_context));
|
2012-10-11 19:08:23 +02:00
|
|
|
}
|
|
|
|
|
2013-05-01 07:39:08 -04:00
|
|
|
protected:
|
|
|
|
/// @brief Finds an option definition within the server's option space
|
2013-07-11 10:34:43 +02:00
|
|
|
///
|
|
|
|
/// Given an option space and an option code, find the correpsonding
|
2013-05-01 07:39:08 -04:00
|
|
|
/// option defintion within the server's option defintion storage.
|
|
|
|
///
|
2013-07-11 10:34:43 +02:00
|
|
|
/// @param option_space name of the parameter option space
|
|
|
|
/// @param option_code numeric value of the parameter to find
|
|
|
|
/// @return OptionDefintionPtr of the option defintion or an
|
2013-05-01 07:39:08 -04:00
|
|
|
/// empty OptionDefinitionPtr if not found.
|
2013-07-11 10:34:43 +02:00
|
|
|
/// @throw DhcpConfigError if the option space requested is not valid
|
|
|
|
/// for this server.
|
2013-05-01 07:39:08 -04:00
|
|
|
virtual OptionDefinitionPtr findServerSpaceOptionDefinition (
|
|
|
|
std::string& option_space, uint32_t option_code) {
|
|
|
|
OptionDefinitionPtr def;
|
|
|
|
if (option_space == "dhcp4" &&
|
|
|
|
LibDHCP::isStandardOption(Option::V4, option_code)) {
|
|
|
|
def = LibDHCP::getOptionDef(Option::V4, option_code);
|
|
|
|
} else if (option_space == "dhcp6") {
|
|
|
|
isc_throw(DhcpConfigError, "'dhcp6' option space name is reserved"
|
|
|
|
<< " for DHCPv6 server");
|
2013-10-23 21:23:14 +02:00
|
|
|
} else {
|
|
|
|
// Check if this is a vendor-option. If it is, get vendor-specific
|
|
|
|
// definition.
|
2014-09-22 16:38:14 +02:00
|
|
|
uint32_t vendor_id = CfgOption::optionSpaceToVendorId(option_space);
|
2013-10-23 21:23:14 +02:00
|
|
|
if (vendor_id) {
|
|
|
|
def = LibDHCP::getVendorOptionDef(Option::V4, vendor_id, option_code);
|
|
|
|
}
|
2013-10-22 12:27:07 +02:00
|
|
|
}
|
|
|
|
|
2013-05-01 07:39:08 -04:00
|
|
|
return (def);
|
2012-10-11 19:08:23 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-07-11 10:34:43 +02:00
|
|
|
/// @brief Parser for IPv4 pool definitions.
|
2013-05-01 07:39:08 -04:00
|
|
|
///
|
2013-07-11 10:34:43 +02:00
|
|
|
/// This is the IPv4 derivation of the PoolParser class and handles pool
|
|
|
|
/// definitions, i.e. a list of entries of one of two syntaxes: min-max and
|
|
|
|
/// prefix/len for IPv4 pools. Pool4 objects are created and stored in chosen
|
2013-05-01 07:39:08 -04:00
|
|
|
/// PoolStorage container.
|
2012-10-11 19:08:23 +02:00
|
|
|
///
|
2013-05-01 07:39:08 -04:00
|
|
|
/// It is useful for parsing Dhcp4/subnet4[X]/pool parameters.
|
|
|
|
class Pool4Parser : public PoolParser {
|
2012-10-11 19:08:23 +02:00
|
|
|
public:
|
|
|
|
|
2013-05-01 07:39:08 -04:00
|
|
|
/// @brief Constructor.
|
|
|
|
///
|
|
|
|
/// @param param_name name of the parameter. Note, it is passed through
|
|
|
|
/// but unused, parameter is currently always "Dhcp4/subnet4[X]/pool"
|
|
|
|
/// @param pools storage container in which to store the parsed pool
|
|
|
|
/// upon "commit"
|
|
|
|
Pool4Parser(const std::string& param_name, PoolStoragePtr pools)
|
|
|
|
:PoolParser(param_name, pools) {
|
2012-10-11 19:08:23 +02:00
|
|
|
}
|
|
|
|
|
2013-05-01 07:39:08 -04:00
|
|
|
protected:
|
|
|
|
/// @brief Creates a Pool4 object given a IPv4 prefix and the prefix length.
|
2012-10-11 19:08:23 +02:00
|
|
|
///
|
2013-05-01 07:39:08 -04:00
|
|
|
/// @param addr is the IPv4 prefix of the pool.
|
|
|
|
/// @param len is the prefix length.
|
2013-07-11 10:34:43 +02:00
|
|
|
/// @param ignored dummy parameter to provide symmetry between the
|
2013-05-06 11:45:27 -04:00
|
|
|
/// PoolParser derivations. The V6 derivation requires a third value.
|
2013-07-11 10:34:43 +02:00
|
|
|
/// @return returns a PoolPtr to the new Pool4 object.
|
2013-05-06 11:45:27 -04:00
|
|
|
PoolPtr poolMaker (IOAddress &addr, uint32_t len, int32_t) {
|
2013-05-01 07:39:08 -04:00
|
|
|
return (PoolPtr(new Pool4(addr, len)));
|
|
|
|
}
|
2012-12-21 12:53:31 +01:00
|
|
|
|
2013-05-01 07:39:08 -04:00
|
|
|
/// @brief Creates a Pool4 object given starting and ending IPv4 addresses.
|
|
|
|
///
|
|
|
|
/// @param min is the first IPv4 address in the pool.
|
|
|
|
/// @param max is the last IPv4 address in the pool.
|
2013-07-11 10:34:43 +02:00
|
|
|
/// @param ignored dummy parameter to provide symmetry between the
|
2013-05-01 07:39:08 -04:00
|
|
|
/// PoolParser derivations. The V6 derivation requires a third value.
|
2013-07-11 10:34:43 +02:00
|
|
|
/// @return returns a PoolPtr to the new Pool4 object.
|
2013-05-06 11:45:27 -04:00
|
|
|
PoolPtr poolMaker (IOAddress &min, IOAddress &max, int32_t) {
|
2013-05-01 07:39:08 -04:00
|
|
|
return (PoolPtr(new Pool4(min, max)));
|
2012-10-11 19:08:23 +02:00
|
|
|
}
|
2013-05-01 07:39:08 -04:00
|
|
|
};
|
2012-10-11 19:08:23 +02:00
|
|
|
|
2014-07-27 21:47:35 -04:00
|
|
|
class Pools4ListParser : public PoolsListParser {
|
|
|
|
public:
|
|
|
|
Pools4ListParser(const std::string& dummy, PoolStoragePtr pools)
|
|
|
|
:PoolsListParser(dummy, pools) {
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ParserPtr poolParserMaker(PoolStoragePtr storage) {
|
|
|
|
return (ParserPtr(new Pool4Parser("pool", storage)));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-05-01 07:39:08 -04:00
|
|
|
/// @brief This class parses a single IPv4 subnet.
|
|
|
|
///
|
2013-07-11 10:34:43 +02:00
|
|
|
/// This is the IPv4 derivation of the SubnetConfigParser class and it parses
|
|
|
|
/// the whole subnet definition. It creates parsersfor received configuration
|
2013-05-01 07:39:08 -04:00
|
|
|
/// parameters as needed.
|
|
|
|
class Subnet4ConfigParser : public SubnetConfigParser {
|
|
|
|
public:
|
|
|
|
/// @brief Constructor
|
2012-10-11 19:08:23 +02:00
|
|
|
///
|
2013-05-01 07:39:08 -04:00
|
|
|
/// @param ignored first parameter
|
|
|
|
/// stores global scope parameters, options, option defintions.
|
2013-05-06 11:45:27 -04:00
|
|
|
Subnet4ConfigParser(const std::string&)
|
2014-01-31 20:13:58 +01:00
|
|
|
:SubnetConfigParser("", globalContext(), IOAddress("0.0.0.0")) {
|
2013-07-11 10:34:43 +02:00
|
|
|
}
|
2013-05-01 07:39:08 -04:00
|
|
|
|
2014-04-28 16:58:24 +02:00
|
|
|
/// @brief Parses a single IPv4 subnet configuration and adds to the
|
|
|
|
/// Configuration Manager.
|
|
|
|
///
|
|
|
|
/// @param subnet A new subnet being configured.
|
|
|
|
void build(ConstElementPtr subnet) {
|
|
|
|
SubnetConfigParser::build(subnet);
|
|
|
|
|
2012-12-21 12:53:31 +01:00
|
|
|
if (subnet_) {
|
2013-05-06 11:45:27 -04:00
|
|
|
Subnet4Ptr sub4ptr = boost::dynamic_pointer_cast<Subnet4>(subnet_);
|
|
|
|
if (!sub4ptr) {
|
|
|
|
// If we hit this, it is a programming error.
|
2013-07-11 10:34:43 +02:00
|
|
|
isc_throw(Unexpected,
|
2013-05-06 11:45:27 -04:00
|
|
|
"Invalid cast in Subnet4ConfigParser::commit");
|
|
|
|
}
|
|
|
|
|
2014-01-31 20:13:58 +01:00
|
|
|
// Set relay information if it was parsed
|
|
|
|
if (relay_info_) {
|
2014-02-10 16:07:02 +01:00
|
|
|
sub4ptr->setRelayInfo(*relay_info_);
|
2014-01-31 20:13:58 +01:00
|
|
|
}
|
|
|
|
|
2014-04-28 16:58:24 +02:00
|
|
|
// Adding a subnet to the Configuration Manager may fail if the
|
|
|
|
// subnet id is invalid (duplicate). Thus, we catch exceptions
|
|
|
|
// here to append a position in the configuration string.
|
|
|
|
try {
|
|
|
|
isc::dhcp::CfgMgr::instance().addSubnet4(sub4ptr);
|
|
|
|
} catch (const std::exception& ex) {
|
|
|
|
isc_throw(DhcpConfigError, ex.what() << " ("
|
|
|
|
<< subnet->getPosition() << ")");
|
|
|
|
}
|
2012-12-21 12:53:31 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-28 16:58:24 +02:00
|
|
|
/// @brief Commits subnet configuration.
|
|
|
|
///
|
|
|
|
/// This function is currently no-op because subnet should already
|
|
|
|
/// be added into the Config Manager in the build().
|
|
|
|
void commit() { }
|
|
|
|
|
2013-05-01 07:39:08 -04:00
|
|
|
protected:
|
2012-12-21 12:53:31 +01:00
|
|
|
|
2013-05-01 07:39:08 -04:00
|
|
|
/// @brief Creates parsers for entries in subnet definition.
|
2013-01-15 15:55:29 +01:00
|
|
|
///
|
2013-05-01 07:39:08 -04:00
|
|
|
/// @param config_id name of the entry
|
|
|
|
///
|
|
|
|
/// @return parser object for specified entry name. Note the caller is
|
|
|
|
/// responsible for deleting the parser created.
|
|
|
|
/// @throw isc::dhcp::DhcpConfigError if trying to create a parser
|
|
|
|
/// for unknown config element
|
|
|
|
DhcpConfigParser* createSubnetConfigParser(const std::string& config_id) {
|
|
|
|
DhcpConfigParser* parser = NULL;
|
|
|
|
if ((config_id.compare("valid-lifetime") == 0) ||
|
|
|
|
(config_id.compare("renew-timer") == 0) ||
|
2014-03-26 12:40:34 +01:00
|
|
|
(config_id.compare("rebind-timer") == 0) ||
|
|
|
|
(config_id.compare("id") == 0)) {
|
2013-05-01 07:39:08 -04:00
|
|
|
parser = new Uint32Parser(config_id, uint32_values_);
|
2013-07-11 10:34:43 +02:00
|
|
|
} else if ((config_id.compare("subnet") == 0) ||
|
2013-10-11 20:03:40 +02:00
|
|
|
(config_id.compare("interface") == 0) ||
|
2014-02-04 12:17:54 +01:00
|
|
|
(config_id.compare("client-class") == 0) ||
|
2013-10-11 20:03:40 +02:00
|
|
|
(config_id.compare("next-server") == 0)) {
|
2013-05-01 07:39:08 -04:00
|
|
|
parser = new StringParser(config_id, string_values_);
|
2014-07-27 21:47:35 -04:00
|
|
|
} else if (config_id.compare("pools") == 0) {
|
|
|
|
parser = new Pools4ListParser(config_id, pools_);
|
2014-01-31 20:13:58 +01:00
|
|
|
} else if (config_id.compare("relay") == 0) {
|
2014-02-07 17:26:03 +01:00
|
|
|
parser = new RelayInfoParser(config_id, relay_info_, Option::V4);
|
2013-05-01 07:39:08 -04:00
|
|
|
} else if (config_id.compare("option-data") == 0) {
|
2013-07-11 10:34:43 +02:00
|
|
|
parser = new OptionDataListParser(config_id, options_,
|
2013-05-06 11:45:27 -04:00
|
|
|
global_context_,
|
|
|
|
Dhcp4OptionDataParser::factory);
|
2013-01-15 15:55:29 +01:00
|
|
|
} else {
|
2014-04-24 19:02:19 +02:00
|
|
|
isc_throw(NotImplemented, "unsupported parameter: " << config_id);
|
2013-01-15 15:55:29 +01:00
|
|
|
}
|
|
|
|
|
2013-05-01 07:39:08 -04:00
|
|
|
return (parser);
|
2013-01-15 15:55:29 +01:00
|
|
|
}
|
|
|
|
|
2013-05-01 07:39:08 -04:00
|
|
|
/// @brief Determines if the given option space name and code describe
|
2014-08-11 19:12:37 +00:00
|
|
|
/// a standard option for the DHCP4 server.
|
2012-12-21 12:53:31 +01:00
|
|
|
///
|
2013-05-01 07:39:08 -04:00
|
|
|
/// @param option_space is the name of the option space to consider
|
|
|
|
/// @param code is the numeric option code to consider
|
|
|
|
/// @return returns true if the space and code are part of the server's
|
|
|
|
/// standard options.
|
|
|
|
bool isServerStdOption(std::string option_space, uint32_t code) {
|
|
|
|
return ((option_space.compare("dhcp4") == 0)
|
|
|
|
&& LibDHCP::isStandardOption(Option::V4, code));
|
|
|
|
}
|
2013-04-01 11:19:24 -04:00
|
|
|
|
2013-05-01 07:39:08 -04:00
|
|
|
/// @brief Returns the option definition for a given option code from
|
|
|
|
/// the DHCP4 server's standard set of options.
|
|
|
|
/// @param code is the numeric option code of the desired option definition.
|
|
|
|
/// @return returns a pointer the option definition
|
|
|
|
OptionDefinitionPtr getServerStdOptionDefinition (uint32_t code) {
|
|
|
|
return (LibDHCP::getOptionDef(Option::V4, code));
|
|
|
|
}
|
2013-01-04 13:47:37 +01:00
|
|
|
|
2013-05-01 07:39:08 -04:00
|
|
|
/// @brief Issues a DHCP4 server specific warning regarding duplicate subnet
|
2013-07-11 10:34:43 +02:00
|
|
|
/// options.
|
|
|
|
///
|
2013-05-01 07:39:08 -04:00
|
|
|
/// @param code is the numeric option code of the duplicate option
|
2013-07-11 10:34:43 +02:00
|
|
|
/// @param addr is the subnet address
|
2013-05-01 07:39:08 -04:00
|
|
|
/// @todo a means to know the correct logger and perhaps a common
|
2013-07-11 10:34:43 +02:00
|
|
|
/// message would allow this method to be emitted by the base class.
|
2013-05-01 07:39:08 -04:00
|
|
|
virtual void duplicate_option_warning(uint32_t code,
|
|
|
|
isc::asiolink::IOAddress& addr) {
|
|
|
|
LOG_WARN(dhcp4_logger, DHCP4_CONFIG_OPTION_DUPLICATE)
|
|
|
|
.arg(code).arg(addr.toText());
|
|
|
|
}
|
2012-10-11 19:08:23 +02:00
|
|
|
|
2013-05-01 07:39:08 -04:00
|
|
|
/// @brief Instantiates the IPv4 Subnet based on a given IPv4 address
|
2013-07-11 10:34:43 +02:00
|
|
|
/// and prefix length.
|
|
|
|
///
|
2013-05-01 07:39:08 -04:00
|
|
|
/// @param addr is IPv4 address of the subnet.
|
2013-07-11 10:34:43 +02:00
|
|
|
/// @param len is the prefix length
|
2013-05-01 07:39:08 -04:00
|
|
|
void initSubnet(isc::asiolink::IOAddress addr, uint8_t len) {
|
2014-05-27 18:55:17 +02:00
|
|
|
// The renew-timer and rebind-timer are optional. If not set, the
|
|
|
|
// option 58 and 59 will not be sent to a client. In this case the
|
|
|
|
// client will use default values based on the valid-lifetime.
|
|
|
|
Triplet<uint32_t> t1 = getOptionalParam("renew-timer");
|
|
|
|
Triplet<uint32_t> t2 = getOptionalParam("rebind-timer");
|
|
|
|
// The valid-lifetime is mandatory. It may be specified for a
|
|
|
|
// particular subnet. If not, the global value should be present.
|
|
|
|
// If there is no global value, exception is thrown.
|
2012-10-11 19:08:23 +02:00
|
|
|
Triplet<uint32_t> valid = getParam("valid-lifetime");
|
2014-03-26 12:40:34 +01:00
|
|
|
// Subnet ID is optional. If it is not supplied the value of 0 is used,
|
|
|
|
// which means autogenerate.
|
|
|
|
SubnetID subnet_id =
|
|
|
|
static_cast<SubnetID>(uint32_values_->getOptionalParam("id", 0));
|
2012-10-11 19:08:23 +02:00
|
|
|
|
2014-05-27 18:55:17 +02:00
|
|
|
stringstream s;
|
|
|
|
s << addr << "/" << static_cast<int>(len) << " with params: ";
|
|
|
|
// t1 and t2 are optional may be not specified.
|
|
|
|
if (!t1.unspecified()) {
|
|
|
|
s << "t1=" << t1 << ", ";
|
|
|
|
}
|
|
|
|
if (!t2.unspecified()) {
|
|
|
|
s << "t2=" << t2 << ", ";
|
|
|
|
}
|
|
|
|
s <<"valid-lifetime=" << valid;
|
2012-10-11 19:08:23 +02:00
|
|
|
|
2014-05-27 18:55:17 +02:00
|
|
|
LOG_INFO(dhcp4_logger, DHCP4_CONFIG_NEW_SUBNET).arg(s.str());
|
2012-10-11 19:08:23 +02:00
|
|
|
|
2014-03-26 12:40:34 +01:00
|
|
|
Subnet4Ptr subnet4(new Subnet4(addr, len, t1, t2, valid, subnet_id));
|
2013-10-17 19:10:50 +02:00
|
|
|
subnet_ = subnet4;
|
2013-10-11 20:03:40 +02:00
|
|
|
|
|
|
|
// Try global value first
|
|
|
|
try {
|
|
|
|
string next_server = globalContext()->string_values_->getParam("next-server");
|
2013-10-22 15:16:17 +02:00
|
|
|
if (!next_server.empty()) {
|
|
|
|
subnet4->setSiaddr(IOAddress(next_server));
|
|
|
|
}
|
2013-10-11 20:03:40 +02:00
|
|
|
} catch (const DhcpConfigError&) {
|
2013-10-17 19:10:50 +02:00
|
|
|
// Don't care. next_server is optional. We can live without it
|
2014-04-25 14:06:04 +02:00
|
|
|
} catch (...) {
|
|
|
|
isc_throw(DhcpConfigError, "invalid parameter next-server ("
|
|
|
|
<< globalContext()->string_values_->getPosition("next-server")
|
|
|
|
<< ")");
|
2013-10-11 20:03:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Try subnet specific value if it's available
|
|
|
|
try {
|
|
|
|
string next_server = string_values_->getParam("next-server");
|
2013-10-22 15:16:17 +02:00
|
|
|
if (!next_server.empty()) {
|
|
|
|
subnet4->setSiaddr(IOAddress(next_server));
|
|
|
|
}
|
2013-10-11 20:03:40 +02:00
|
|
|
} catch (const DhcpConfigError&) {
|
2013-10-17 19:10:50 +02:00
|
|
|
// Don't care. next_server is optional. We can live without it
|
2014-04-25 14:06:04 +02:00
|
|
|
} catch (...) {
|
|
|
|
isc_throw(DhcpConfigError, "invalid parameter next-server ("
|
|
|
|
<< string_values_->getPosition("next-server")
|
|
|
|
<< ")");
|
2013-10-11 20:03:40 +02:00
|
|
|
}
|
2014-02-04 12:17:54 +01:00
|
|
|
|
2014-04-25 14:06:04 +02:00
|
|
|
|
2014-02-04 12:17:54 +01:00
|
|
|
// Try setting up client class (if specified)
|
|
|
|
try {
|
|
|
|
string client_class = string_values_->getParam("client-class");
|
|
|
|
subnet4->allowClientClass(client_class);
|
|
|
|
} catch (const DhcpConfigError&) {
|
|
|
|
// That's ok if it fails. client-class is optional.
|
|
|
|
}
|
2012-10-11 19:08:23 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-05-01 07:39:08 -04:00
|
|
|
/// @brief this class parses list of DHCP4 subnets
|
2012-10-11 19:08:23 +02:00
|
|
|
///
|
|
|
|
/// This is a wrapper parser that handles the whole list of Subnet4
|
|
|
|
/// definitions. It iterates over all entries and creates Subnet4ConfigParser
|
|
|
|
/// for each entry.
|
2013-01-04 14:15:40 +01:00
|
|
|
class Subnets4ListConfigParser : public DhcpConfigParser {
|
2012-10-11 19:08:23 +02:00
|
|
|
public:
|
|
|
|
|
|
|
|
/// @brief constructor
|
|
|
|
///
|
2013-05-06 11:45:27 -04:00
|
|
|
/// @param dummy first argument, always ignored. All parsers accept a
|
2013-05-01 07:39:08 -04:00
|
|
|
/// string parameter "name" as their first argument.
|
2012-10-11 19:08:23 +02:00
|
|
|
Subnets4ListConfigParser(const std::string&) {
|
|
|
|
}
|
|
|
|
|
|
|
|
/// @brief parses contents of the list
|
|
|
|
///
|
|
|
|
/// Iterates over all entries on the list and creates Subnet4ConfigParser
|
|
|
|
/// for each entry.
|
|
|
|
///
|
|
|
|
/// @param subnets_list pointer to a list of IPv4 subnets
|
|
|
|
void build(ConstElementPtr subnets_list) {
|
2014-04-28 16:58:24 +02:00
|
|
|
// @todo: Implement more subtle reconfiguration than toss
|
|
|
|
// the old one and replace with the new one.
|
|
|
|
|
|
|
|
// remove old subnets
|
|
|
|
CfgMgr::instance().deleteSubnets4();
|
|
|
|
|
2012-10-11 19:08:23 +02:00
|
|
|
BOOST_FOREACH(ConstElementPtr subnet, subnets_list->listValue()) {
|
2013-05-06 11:45:27 -04:00
|
|
|
ParserPtr parser(new Subnet4ConfigParser("subnet"));
|
2012-10-11 19:08:23 +02:00
|
|
|
parser->build(subnet);
|
|
|
|
subnets_.push_back(parser);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// @brief commits subnets definitions.
|
|
|
|
///
|
2013-05-01 07:39:08 -04:00
|
|
|
/// Iterates over all Subnet4 parsers. Each parser contains definitions of
|
|
|
|
/// a single subnet and its parameters and commits each subnet separately.
|
2012-10-11 19:08:23 +02:00
|
|
|
void commit() {
|
|
|
|
BOOST_FOREACH(ParserPtr subnet, subnets_) {
|
|
|
|
subnet->commit();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/// @brief Returns Subnet4ListConfigParser object
|
|
|
|
/// @param param_name name of the parameter
|
|
|
|
/// @return Subnets4ListConfigParser object
|
2013-01-04 14:15:40 +01:00
|
|
|
static DhcpConfigParser* factory(const std::string& param_name) {
|
2012-10-11 19:08:23 +02:00
|
|
|
return (new Subnets4ListConfigParser(param_name));
|
|
|
|
}
|
|
|
|
|
|
|
|
/// @brief collection of subnet parsers.
|
|
|
|
ParserCollection subnets_;
|
2012-12-21 12:53:31 +01:00
|
|
|
|
2012-10-11 19:08:23 +02:00
|
|
|
};
|
|
|
|
|
2012-12-21 12:07:43 +01:00
|
|
|
} // anonymous namespace
|
|
|
|
|
|
|
|
namespace isc {
|
|
|
|
namespace dhcp {
|
|
|
|
|
2012-10-11 19:08:23 +02:00
|
|
|
/// @brief creates global parsers
|
|
|
|
///
|
|
|
|
/// This method creates global parsers that parse global parameters, i.e.
|
|
|
|
/// those that take format of Dhcp4/param1, Dhcp4/param2 and so forth.
|
|
|
|
///
|
|
|
|
/// @param config_id pointer to received global configuration entry
|
|
|
|
/// @return parser for specified global DHCPv4 parameter
|
2013-07-11 10:34:43 +02:00
|
|
|
/// @throw NotImplemented if trying to create a parser for unknown
|
2013-05-01 07:39:08 -04:00
|
|
|
/// config element
|
2014-04-28 17:11:40 +02:00
|
|
|
DhcpConfigParser* createGlobalDhcp4ConfigParser(const std::string& config_id,
|
|
|
|
ConstElementPtr element) {
|
2013-05-01 07:39:08 -04:00
|
|
|
DhcpConfigParser* parser = NULL;
|
2013-04-10 17:02:10 -04:00
|
|
|
if ((config_id.compare("valid-lifetime") == 0) ||
|
|
|
|
(config_id.compare("renew-timer") == 0) ||
|
|
|
|
(config_id.compare("rebind-timer") == 0)) {
|
2013-07-11 10:34:43 +02:00
|
|
|
parser = new Uint32Parser(config_id,
|
2013-05-06 11:45:27 -04:00
|
|
|
globalContext()->uint32_values_);
|
2013-07-10 21:14:03 +02:00
|
|
|
} else if (config_id.compare("interfaces") == 0) {
|
2014-08-29 09:28:30 +02:00
|
|
|
parser = new InterfaceListConfigParser(config_id, globalContext());
|
2013-05-01 07:39:08 -04:00
|
|
|
} else if (config_id.compare("subnet4") == 0) {
|
2013-04-10 17:02:10 -04:00
|
|
|
parser = new Subnets4ListConfigParser(config_id);
|
2013-05-01 07:39:08 -04:00
|
|
|
} else if (config_id.compare("option-data") == 0) {
|
2013-07-11 10:34:43 +02:00
|
|
|
parser = new OptionDataListParser(config_id,
|
|
|
|
globalContext()->options_,
|
2013-05-06 11:45:27 -04:00
|
|
|
globalContext(),
|
2013-04-10 17:02:10 -04:00
|
|
|
Dhcp4OptionDataParser::factory);
|
2013-05-01 07:39:08 -04:00
|
|
|
} else if (config_id.compare("option-def") == 0) {
|
2014-04-25 14:16:43 +02:00
|
|
|
parser = new OptionDefListParser(config_id, globalContext());
|
2013-10-11 20:03:40 +02:00
|
|
|
} else if ((config_id.compare("version") == 0) ||
|
|
|
|
(config_id.compare("next-server") == 0)) {
|
2013-07-11 10:34:43 +02:00
|
|
|
parser = new StringParser(config_id,
|
2013-05-06 11:45:27 -04:00
|
|
|
globalContext()->string_values_);
|
2013-05-01 07:39:08 -04:00
|
|
|
} else if (config_id.compare("lease-database") == 0) {
|
2014-03-25 15:53:02 +01:00
|
|
|
parser = new DbAccessParser(config_id, *globalContext());
|
2013-07-25 12:14:42 +01:00
|
|
|
} else if (config_id.compare("hooks-libraries") == 0) {
|
|
|
|
parser = new HooksLibrariesParser(config_id);
|
2013-10-24 14:35:28 +02:00
|
|
|
} else if (config_id.compare("echo-client-id") == 0) {
|
|
|
|
parser = new BooleanParser(config_id, globalContext()->boolean_values_);
|
2014-01-06 10:56:59 -05:00
|
|
|
} else if (config_id.compare("dhcp-ddns") == 0) {
|
|
|
|
parser = new D2ClientConfigParser(config_id);
|
2013-05-01 07:39:08 -04:00
|
|
|
} else {
|
2014-04-28 17:11:40 +02:00
|
|
|
isc_throw(DhcpConfigError,
|
|
|
|
"unsupported global configuration parameter: "
|
|
|
|
<< config_id << " (" << element->getPosition() << ")");
|
2012-10-11 19:08:23 +02:00
|
|
|
}
|
2013-04-10 17:02:10 -04:00
|
|
|
|
|
|
|
return (parser);
|
2012-10-11 19:08:23 +02:00
|
|
|
}
|
|
|
|
|
2013-10-24 14:35:28 +02:00
|
|
|
void commitGlobalOptions() {
|
2013-12-13 15:47:36 +01:00
|
|
|
// Although the function is modest for now, it is certain that the number
|
|
|
|
// of global switches will increase over time, hence the name.
|
2013-10-24 14:35:28 +02:00
|
|
|
|
|
|
|
// Set whether v4 server is supposed to echo back client-id (yes = RFC6842
|
|
|
|
// compatible, no = backward compatibility)
|
|
|
|
try {
|
|
|
|
bool echo_client_id = globalContext()->boolean_values_->getParam("echo-client-id");
|
|
|
|
CfgMgr::instance().echoClientId(echo_client_id);
|
|
|
|
} catch (...) {
|
|
|
|
// Ignore errors. This flag is optional
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-11 19:08:23 +02:00
|
|
|
isc::data::ConstElementPtr
|
2013-05-01 07:39:08 -04:00
|
|
|
configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set) {
|
2012-10-11 19:08:23 +02:00
|
|
|
if (!config_set) {
|
2012-12-05 15:27:30 +01:00
|
|
|
ConstElementPtr answer = isc::config::createAnswer(1,
|
|
|
|
string("Can't parse NULL config"));
|
|
|
|
return (answer);
|
2012-10-11 19:08:23 +02:00
|
|
|
}
|
|
|
|
|
2013-07-11 10:34:43 +02:00
|
|
|
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_COMMAND,
|
2013-05-01 07:39:08 -04:00
|
|
|
DHCP4_CONFIG_START).arg(config_set->str());
|
2012-10-11 19:08:23 +02:00
|
|
|
|
2013-12-30 18:38:37 +01:00
|
|
|
// Before starting any subnet operations, let's reset the subnet-id counter,
|
|
|
|
// so newly recreated configuration starts with first subnet-id equal 1.
|
|
|
|
Subnet::resetSubnetID();
|
|
|
|
|
2012-12-21 12:53:31 +01:00
|
|
|
// Some of the values specified in the configuration depend on
|
2013-01-10 18:39:03 +01:00
|
|
|
// other values. Typically, the values in the subnet4 structure
|
|
|
|
// depend on the global values. Also, option values configuration
|
|
|
|
// must be performed after the option definitions configurations.
|
2013-01-14 12:25:01 +01:00
|
|
|
// Thus we group parsers and will fire them in the right order:
|
|
|
|
// all parsers other than subnet4 and option-data parser,
|
|
|
|
// option-data parser, subnet4 parser.
|
2012-12-21 12:53:31 +01:00
|
|
|
ParserCollection independent_parsers;
|
2013-01-10 18:19:21 +01:00
|
|
|
ParserPtr subnet_parser;
|
|
|
|
ParserPtr option_parser;
|
2013-07-10 21:14:03 +02:00
|
|
|
ParserPtr iface_parser;
|
2012-12-21 12:53:31 +01:00
|
|
|
|
2013-07-25 12:14:42 +01:00
|
|
|
// Some of the parsers alter the state of the system in a way that can't
|
|
|
|
// easily be undone. (Or alter it in a way such that undoing the change has
|
2013-08-13 13:14:38 +01:00
|
|
|
// the same risk of failure as doing the change.)
|
2014-01-06 10:56:59 -05:00
|
|
|
ParserPtr hooks_parser;
|
2013-07-25 12:14:42 +01:00
|
|
|
|
2012-12-21 12:53:31 +01:00
|
|
|
// The subnet parsers implement data inheritance by directly
|
2013-01-04 13:47:37 +01:00
|
|
|
// accessing global storage. For this reason the global data
|
2012-12-21 12:53:31 +01:00
|
|
|
// parsers must store the parsed data into global storages
|
2013-01-04 13:47:37 +01:00
|
|
|
// immediately. This may cause data inconsistency if the
|
|
|
|
// parsing operation fails after the global storage has been
|
|
|
|
// modified. We need to preserve the original global data here
|
|
|
|
// so as we can rollback changes when an error occurs.
|
2013-05-06 11:45:27 -04:00
|
|
|
ParserContext original_context(*globalContext());
|
2012-12-21 12:53:31 +01:00
|
|
|
|
2013-05-01 07:39:08 -04:00
|
|
|
// Answer will hold the result.
|
2012-12-21 12:53:31 +01:00
|
|
|
ConstElementPtr answer;
|
2013-05-01 07:39:08 -04:00
|
|
|
// Rollback informs whether error occured and original data
|
2012-12-21 12:53:31 +01:00
|
|
|
// have to be restored to global storages.
|
|
|
|
bool rollback = false;
|
2013-01-18 12:05:12 +00:00
|
|
|
// config_pair holds the details of the current parser when iterating over
|
2013-01-21 20:57:57 +00:00
|
|
|
// the parsers. It is declared outside the loops so in case of an error,
|
|
|
|
// the name of the failing parser can be retrieved in the "catch" clause.
|
2013-01-18 12:05:12 +00:00
|
|
|
ConfigPair config_pair;
|
2012-10-11 19:08:23 +02:00
|
|
|
try {
|
2013-01-10 18:39:03 +01:00
|
|
|
// Make parsers grouping.
|
2013-01-10 18:19:21 +01:00
|
|
|
const std::map<std::string, ConstElementPtr>& values_map =
|
2013-05-01 07:39:08 -04:00
|
|
|
config_set->mapValue();
|
2013-01-21 20:57:57 +00:00
|
|
|
BOOST_FOREACH(config_pair, values_map) {
|
2014-04-28 17:11:40 +02:00
|
|
|
ParserPtr parser(createGlobalDhcp4ConfigParser(config_pair.first,
|
|
|
|
config_pair.second));
|
2013-01-21 20:57:57 +00:00
|
|
|
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL, DHCP4_PARSER_CREATED)
|
|
|
|
.arg(config_pair.first);
|
2013-01-10 18:19:21 +01:00
|
|
|
if (config_pair.first == "subnet4") {
|
|
|
|
subnet_parser = parser;
|
|
|
|
} else if (config_pair.first == "option-data") {
|
|
|
|
option_parser = parser;
|
2013-07-10 21:14:03 +02:00
|
|
|
} else if (config_pair.first == "interfaces") {
|
|
|
|
// The interface parser is independent from any other
|
|
|
|
// parser and can be run here before any other parsers.
|
|
|
|
iface_parser = parser;
|
|
|
|
parser->build(config_pair.second);
|
2013-07-25 12:14:42 +01:00
|
|
|
} else if (config_pair.first == "hooks-libraries") {
|
|
|
|
// Executing commit will alter currently-loaded hooks
|
|
|
|
// libraries. Check if the supplied libraries are valid,
|
|
|
|
// but defer the commit until everything else has committed.
|
2014-01-06 10:56:59 -05:00
|
|
|
hooks_parser = parser;
|
2013-07-25 12:14:42 +01:00
|
|
|
parser->build(config_pair.second);
|
2013-01-10 18:19:21 +01:00
|
|
|
} else {
|
2013-01-10 18:39:03 +01:00
|
|
|
// Those parsers should be started before other
|
|
|
|
// parsers so we can call build straight away.
|
2012-12-21 12:53:31 +01:00
|
|
|
independent_parsers.push_back(parser);
|
|
|
|
parser->build(config_pair.second);
|
|
|
|
// The commit operation here may modify the global storage
|
|
|
|
// but we need it so as the subnet6 parser can access the
|
|
|
|
// parsed data.
|
|
|
|
parser->commit();
|
|
|
|
}
|
|
|
|
}
|
2012-10-11 19:08:23 +02:00
|
|
|
|
2013-01-10 18:39:03 +01:00
|
|
|
// The option values parser is the next one to be run.
|
2013-01-10 18:19:21 +01:00
|
|
|
std::map<std::string, ConstElementPtr>::const_iterator option_config =
|
|
|
|
values_map.find("option-data");
|
|
|
|
if (option_config != values_map.end()) {
|
2014-04-29 18:27:14 +02:00
|
|
|
config_pair.first = "option-data";
|
2013-01-10 18:19:21 +01:00
|
|
|
option_parser->build(option_config->second);
|
|
|
|
option_parser->commit();
|
|
|
|
}
|
|
|
|
|
2013-01-10 18:39:03 +01:00
|
|
|
// The subnet parser is the last one to be run.
|
2013-01-10 18:19:21 +01:00
|
|
|
std::map<std::string, ConstElementPtr>::const_iterator subnet_config =
|
|
|
|
values_map.find("subnet4");
|
|
|
|
if (subnet_config != values_map.end()) {
|
2014-04-29 18:27:14 +02:00
|
|
|
config_pair.first = "subnet4";
|
2013-01-10 18:19:21 +01:00
|
|
|
subnet_parser->build(subnet_config->second);
|
2012-10-11 19:08:23 +02:00
|
|
|
}
|
2012-12-21 12:53:31 +01:00
|
|
|
|
2012-10-11 19:08:23 +02:00
|
|
|
} catch (const isc::Exception& ex) {
|
2013-01-21 22:01:48 +00:00
|
|
|
LOG_ERROR(dhcp4_logger, DHCP4_PARSER_FAIL)
|
2013-01-18 12:05:12 +00:00
|
|
|
.arg(config_pair.first).arg(ex.what());
|
2014-08-25 20:10:39 +02:00
|
|
|
answer = isc::config::createAnswer(1, ex.what());
|
2012-12-21 12:53:31 +01:00
|
|
|
|
|
|
|
// An error occured, so make sure that we restore original data.
|
|
|
|
rollback = true;
|
|
|
|
|
2012-10-11 19:08:23 +02:00
|
|
|
} catch (...) {
|
2013-05-01 07:39:08 -04:00
|
|
|
// For things like bad_cast in boost::lexical_cast
|
2013-01-21 22:01:48 +00:00
|
|
|
LOG_ERROR(dhcp4_logger, DHCP4_PARSER_EXCEPTION).arg(config_pair.first);
|
2014-08-25 20:10:39 +02:00
|
|
|
answer = isc::config::createAnswer(1, "undefined configuration"
|
|
|
|
" processing error");
|
2012-12-21 12:53:31 +01:00
|
|
|
|
|
|
|
// An error occured, so make sure that we restore original data.
|
|
|
|
rollback = true;
|
2012-10-11 19:08:23 +02:00
|
|
|
}
|
|
|
|
|
2012-12-21 12:53:31 +01:00
|
|
|
// So far so good, there was no parsing error so let's commit the
|
|
|
|
// configuration. This will add created subnets and option values into
|
|
|
|
// the server's configuration.
|
|
|
|
// This operation should be exception safe but let's make sure.
|
|
|
|
if (!rollback) {
|
|
|
|
try {
|
2013-01-10 18:39:03 +01:00
|
|
|
if (subnet_parser) {
|
|
|
|
subnet_parser->commit();
|
2012-12-21 12:53:31 +01:00
|
|
|
}
|
2013-07-10 21:14:03 +02:00
|
|
|
|
2014-08-29 09:28:30 +02:00
|
|
|
// No need to commit interface names as this is handled by the
|
|
|
|
// CfgMgr::commit() function.
|
2013-08-13 13:14:38 +01:00
|
|
|
|
2013-10-24 14:35:28 +02:00
|
|
|
// Apply global options
|
|
|
|
commitGlobalOptions();
|
|
|
|
|
2013-08-13 13:14:38 +01:00
|
|
|
// This occurs last as if it succeeds, there is no easy way
|
|
|
|
// revert it. As a result, the failure to commit a subsequent
|
|
|
|
// change causes problems when trying to roll back.
|
2014-01-06 10:56:59 -05:00
|
|
|
if (hooks_parser) {
|
|
|
|
hooks_parser->commit();
|
2013-08-13 13:14:38 +01:00
|
|
|
}
|
2012-12-21 12:53:31 +01:00
|
|
|
}
|
|
|
|
catch (const isc::Exception& ex) {
|
2013-01-10 15:30:10 +00:00
|
|
|
LOG_ERROR(dhcp4_logger, DHCP4_PARSER_COMMIT_FAIL).arg(ex.what());
|
2014-08-25 20:10:39 +02:00
|
|
|
answer = isc::config::createAnswer(2, ex.what());
|
2012-12-21 12:53:31 +01:00
|
|
|
rollback = true;
|
|
|
|
} catch (...) {
|
2013-05-01 07:39:08 -04:00
|
|
|
// For things like bad_cast in boost::lexical_cast
|
2013-01-10 15:30:10 +00:00
|
|
|
LOG_ERROR(dhcp4_logger, DHCP4_PARSER_COMMIT_EXCEPTION);
|
2014-08-25 20:10:39 +02:00
|
|
|
answer = isc::config::createAnswer(2, "undefined configuration"
|
|
|
|
" parsing error");
|
2012-12-21 12:53:31 +01:00
|
|
|
rollback = true;
|
2012-10-11 19:08:23 +02:00
|
|
|
}
|
|
|
|
}
|
2012-12-21 12:53:31 +01:00
|
|
|
|
|
|
|
// Rollback changes as the configuration parsing failed.
|
|
|
|
if (rollback) {
|
2013-05-06 11:45:27 -04:00
|
|
|
globalContext().reset(new ParserContext(original_context));
|
2012-10-11 19:08:23 +02:00
|
|
|
return (answer);
|
|
|
|
}
|
|
|
|
|
2014-08-18 18:43:51 +02:00
|
|
|
LOG_INFO(dhcp4_logger, DHCP4_CONFIG_COMPLETE)
|
2014-08-29 11:58:46 +02:00
|
|
|
.arg(CfgMgr::instance().getCurrentCfg()->
|
2014-09-15 19:27:53 +02:00
|
|
|
getConfigSummary(SrvConfig::CFGSEL_ALL4));
|
2012-10-11 19:08:23 +02:00
|
|
|
|
2012-12-21 12:53:31 +01:00
|
|
|
// Everything was fine. Configuration is successful.
|
2014-08-25 20:10:39 +02:00
|
|
|
answer = isc::config::createAnswer(0, "Configuration successful.");
|
2012-10-11 19:08:23 +02:00
|
|
|
return (answer);
|
|
|
|
}
|
|
|
|
|
2013-05-13 16:07:02 -04:00
|
|
|
ParserContextPtr& globalContext() {
|
2013-05-06 11:45:27 -04:00
|
|
|
static ParserContextPtr global_context_ptr(new ParserContext(Option::V4));
|
|
|
|
return (global_context_ptr);
|
2012-12-21 12:07:43 +01:00
|
|
|
}
|
|
|
|
|
2013-05-06 11:45:27 -04:00
|
|
|
|
|
|
|
|
2012-10-11 19:08:23 +02:00
|
|
|
}; // end of isc::dhcp namespace
|
|
|
|
}; // end of isc namespace
|