PARAMETERS "parameters"
EXPIRED_LEASES_PROCESSING "expired-leases-processing"
+ RECLAIM_TIMER_WAIT_TIME "reclaim-timer-wait-time"
+ FLUSH_RECLAIMED_TIMER_WAIT_TIME "flush-reclaimed-timer-wait-time"
+ HOLD_RECLAIMED_TIME "hold-reclaimed-time"
+ MAX_RECLAIM_LEASES "max-reclaim-leases"
+ MAX_RECLAIM_TIME "max-reclaim-time"
+ UNWARNED_RECLAIM_CYCLES "unwarned-reclaim-cycles"
- SERVER_ID "server-id"
- IDENTIFIER "identifier"
- HTYPE "htype"
- TIME "time"
- ENTERPRISE_ID "enterprise-id"
-
DHCP4O6_PORT "dhcp4o6-port"
CONTROL_SOCKET "control-socket"
%token <bool> BOOLEAN "boolean"
%type <ElementPtr> value
+%type <ElementPtr> socket_type
+ %type <ElementPtr> db_type
+%type <ElementPtr> ncr_protocol_value
+%type <ElementPtr> replace_client_name_value
%printer { yyoutput << $$; } <*>;
} else if ((config_id.compare("next-server") == 0)) {
parser = new StringParser(config_id,
globalContext()->string_values_);
- } else if (config_id.compare("lease-database") == 0) {
- parser = new DbAccessParser(config_id, DbAccessParser::LEASE_DB);
- } else if (config_id.compare("hosts-database") == 0) {
- parser = new DbAccessParser(config_id, DbAccessParser::HOSTS_DB);
- // hooks-libraries are now migrated to SimpleParser.
- // lease-database and hosts-database have been converted to SimpleParser already.
- } else if (config_id.compare("hooks-libraries") == 0) {
- parser = new HooksLibrariesParser(config_id);
-- } else if (config_id.compare("echo-client-id") == 0) {
++ // hooks-libraries are now migrated to SimpleParser.
++ // lease-database and hosts-database have been converted to SimpleParser already.
++ } else if (config_id.compare("echo-client-id") == 0) {
parser = new BooleanParser(config_id, globalContext()->boolean_values_);
- } else if (config_id.compare("dhcp-ddns") == 0) {
- parser = new D2ClientConfigParser(config_id);
+ // dhcp-ddns has been converted to SimpleParser.
} else if (config_id.compare("match-client-id") == 0) {
parser = new BooleanParser(config_id, globalContext()->boolean_values_);
// control-socket has been converted to SimpleParser already.
// Please do not change this order!
ParserCollection independent_parsers;
ParserPtr subnet_parser;
- ParserPtr leases_parser;
- ParserPtr iface_parser;
- ParserPtr client_classes_parser;
// 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
ConfigPair config_pair;
try {
++ SrvConfigPtr srv_cfg = CfgMgr::instance().getStagingCfg();
++
// This is a way to convert ConstElementPtr to ElementPtr.
// We need a config that can be edited, because we will insert
// default values and will insert derived values as well.
ConstElementPtr option_defs = mutable_cfg->get("option-def");
if (option_defs) {
OptionDefListParser parser;
-- CfgOptionDefPtr cfg_option_def = CfgMgr::instance().getStagingCfg()->getCfgOptionDef();
++ CfgOptionDefPtr cfg_option_def = srv_cfg->getCfgOptionDef();
parser.parse(cfg_option_def, option_defs);
}
const std::map<std::string, ConstElementPtr>& values_map =
mutable_cfg->mapValue();
BOOST_FOREACH(config_pair, values_map) {
- SrvConfigPtr srv_cfg = CfgMgr::instance().getStagingCfg();
-
+ // In principle we could have the following code structured as a series
+ // of long if else if clauses. That would give a marginal performance
+ // boost, but would make the code less readable. We had serious issues
+ // with the parser code debugability, so I decided to keep it as a
+ // series of independent ifs.
-
if (config_pair.first == "option-def") {
// This is converted to SimpleParser and is handled already above.
continue;
continue;
}
- CfgIfacePtr cfg_iface = CfgMgr::instance().getStagingCfg()->getCfgIface();
+ if (config_pair.first == "interfaces-config") {
+ IfacesConfigParser parser(AF_INET);
- CfgMgr::instance().getStagingCfg()->setD2ClientConfig(cfg);
++ CfgIfacePtr cfg_iface = srv_cfg->getCfgIface();
+ parser.parse(cfg_iface, config_pair.second);
+ continue;
+ }
+
+ if (config_pair.first == "expired-leases-processing") {
+ ExpirationConfigParser parser;
+ parser.parse(config_pair.second);
+ continue;
+ }
+
+ if (config_pair.first == "hooks-libraries") {
+ hooks_parser.parse(config_pair.second);
+ hooks_parser.verifyLibraries();
+ continue;
+ }
+
+ // Legacy DhcpConfigParser stuff below
+ if (config_pair.first == "dhcp-ddns") {
+ // Apply defaults if not in short cut
+ if (!D2ClientConfigParser::isShortCutDisabled(config_pair.second)) {
+ D2ClientConfigParser::setAllDefaults(config_pair.second);
+ }
+ D2ClientConfigParser parser;
+ D2ClientConfigPtr cfg = parser.parse(config_pair.second);
- CfgMgr::instance().getStagingCfg()->setClientClassDictionary(dictionary);
++ srv_cfg->setD2ClientConfig(cfg);
+ continue;
+ }
+
+ if (config_pair.first == "client-classes") {
+ ClientClassDefListParser parser;
+ ClientClassDictionaryPtr dictionary =
+ parser.parse(config_pair.second, AF_INET);
++ srv_cfg->setClientClassDictionary(dictionary);
++ continue;
++ }
++
+ // Please move at the end when migration will be finished.
+ if (config_pair.first == "lease-database") {
+ DbAccessParser parser(DbAccessParser::LEASE_DB);
+ CfgDbAccessPtr cfg_db_access = srv_cfg->getCfgDbAccess();
+ parser.parse(cfg_db_access, config_pair.second);
+ continue;
+ }
+
+ if (config_pair.first == "host-database") {
+ DbAccessParser parser(DbAccessParser::HOSTS_DB);
+ CfgDbAccessPtr cfg_db_access = srv_cfg->getCfgDbAccess();
+ parser.parse(cfg_db_access, config_pair.second);
continue;
}
.arg(config_pair.first);
if (config_pair.first == "subnet4") {
subnet_parser = parser;
- } else if (config_pair.first == "lease-database") {
- leases_parser = parser;
- } else if (config_pair.first == "interfaces-config") {
- // 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);
- } 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.
- hooks_parser = parser;
- parser->build(config_pair.second);
- } else if (config_pair.first == "client-classes") {
- client_classes_parser = parser;
} else {
// Those parsers should be started before other
// parsers so we can call build straight away.
%token <bool> BOOLEAN "boolean"
%type <ElementPtr> value
+ %type <ElementPtr> db_type
%type <ElementPtr> duid_type
+%type <ElementPtr> ncr_protocol_value
+%type <ElementPtr> replace_client_name_value
%printer { yyoutput << $$; } <*>;
} else if (config_id.compare("subnet6") == 0) {
parser = new Subnets6ListConfigParser(config_id);
// option-data and option-def are no longer needed here. They're now
- // converted to SimpleParser and are handled in configureDhcp6Server
- } else if (config_id.compare("version") == 0) {
- parser = new StringParser(config_id,
- globalContext()->string_values_);
+ // converted to SimpleParser and are handled in configureDhcp6Server.
+ // interfaces-config has been converted to SimpleParser.
+ // version was removed - it was a leftover from bindctrl.
- } else if (config_id.compare("lease-database") == 0) {
- parser = new DbAccessParser(config_id, DbAccessParser::LEASE_DB);
- } else if (config_id.compare("hosts-database") == 0) {
- parser = new DbAccessParser(config_id, DbAccessParser::HOSTS_DB);
+ // hooks-libraries is now converted to SimpleParser.
+ // lease-database and hosts-database have been converted to SimpleParser already.
- } else if (config_id.compare("hooks-libraries") == 0) {
- parser = new HooksLibrariesParser(config_id);
- } else if (config_id.compare("dhcp-ddns") == 0) {
- parser = new D2ClientConfigParser(config_id);
// mac-source has been converted to SimpleParser.
+ // dhcp-ddns has been converted to SimpleParser
} else if (config_id.compare("relay-supplied-options") == 0) {
parser = new RSOOListConfigParser(config_id);
// control-socket has been converted to SimpleParser.
// Please do not change this order!
ParserCollection independent_parsers;
ParserPtr subnet_parser;
- ParserPtr leases_parser;
- ParserPtr iface_parser;
- ParserPtr client_classes_parser;
// Some of the parsers alter state of the system that can't easily
// be undone. (Or alter it in a way such that undoing the change
ConfigPair config_pair;
try {
++ SrvConfigPtr srv_config = CfgMgr::instance().getStagingCfg();
++
// This is a way to convert ConstElementPtr to ElementPtr.
// We need a config that can be edited, because we will insert
// default values and will insert derived values as well.
ConstElementPtr option_defs = mutable_cfg->get("option-def");
if (option_defs) {
OptionDefListParser parser;
-- CfgOptionDefPtr cfg_option_def = CfgMgr::instance().getStagingCfg()->getCfgOptionDef();
++ CfgOptionDefPtr cfg_option_def = srv_config->getCfgOptionDef();
parser.parse(cfg_option_def, option_defs);
}
continue;
}
- CfgIfacePtr cfg_iface = CfgMgr::instance().getStagingCfg()->getCfgIface();
+ if (config_pair.first == "interfaces-config") {
+ IfacesConfigParser parser(AF_INET6);
- CfgMgr::instance().getStagingCfg()->setD2ClientConfig(cfg);
++ CfgIfacePtr cfg_iface = srv_config->getCfgIface();
+ parser.parse(cfg_iface, config_pair.second);
+ continue;
+ }
+
+ if (config_pair.first == "expired-leases-processing") {
+ ExpirationConfigParser parser;
+ parser.parse(config_pair.second);
+ continue;
+ }
+
+ if (config_pair.first == "hooks-libraries") {
+ hooks_parser.parse(config_pair.second);
+ hooks_parser.verifyLibraries();
+ continue;
+ }
+
+ if (config_pair.first == "dhcp-ddns") {
+ // Apply defaults if not in short cut
+ if (!D2ClientConfigParser::isShortCutDisabled(config_pair.second)) {
+ D2ClientConfigParser::setAllDefaults(config_pair.second);
+ }
+ D2ClientConfigParser parser;
+ D2ClientConfigPtr cfg = parser.parse(config_pair.second);
- CfgMgr::instance().getStagingCfg()->setClientClassDictionary(dictionary);
++ srv_config->setD2ClientConfig(cfg);
+ continue;
+ }
+
+ if (config_pair.first =="client-classes") {
+ ClientClassDefListParser parser;
+ ClientClassDictionaryPtr dictionary =
+ parser.parse(config_pair.second, AF_INET6);
++ srv_config->setClientClassDictionary(dictionary);
++ continue;
++ }
++
+ // Please move at the end when migration will be finished.
+ if (config_pair.first == "lease-database") {
+ DbAccessParser parser(DbAccessParser::LEASE_DB);
+ CfgDbAccessPtr cfg_db_access = srv_config->getCfgDbAccess();
+ parser.parse(cfg_db_access, config_pair.second);
+ continue;
+ }
+
+ if (config_pair.first == "host-database") {
+ DbAccessParser parser(DbAccessParser::HOSTS_DB);
+ CfgDbAccessPtr cfg_db_access = srv_config->getCfgDbAccess();
+ parser.parse(cfg_db_access, config_pair.second);
continue;
}
.arg(config_pair.first);
if (config_pair.first == "subnet6") {
subnet_parser = parser;
- } else if (config_pair.first == "lease-database") {
- leases_parser = parser;
- } else if (config_pair.first == "hooks-libraries") {
- // Executing the commit will alter currently loaded hooks
- // libraries. Check if the supplied libraries are valid,
- // but defer the commit until after everything else has
- // committed.
- hooks_parser = parser;
- hooks_parser->build(config_pair.second);
- } else if (config_pair.first == "interfaces-config") {
- // The interface parser is independent from any other parser and
- // can be run here before other parsers.
- parser->build(config_pair.second);
- iface_parser = parser;
- } else if (config_pair.first == "client-classes") {
- client_classes_parser = parser;
} else {
// Those parsers should be started before other
// parsers so we can call build straight away.