// configuration attempts.
CfgMgr::instance().rollback();
- // Check obsolete objects.
-
- // Check deprecated objects.
+ // Check deprecated, obsolete or unknown objects.
+ set<string> deprecated;
+ set<string> obsolete;
+ set<string> unknown;
+ for (auto obj : args->mapValue()) {
+ const string& obj_name = obj.first;
+ if ((obj_name == "Dhcp4") || (obj_name == "Logging")) {
+ continue;
+ }
+ if ((obj_name == "Dhcp6") || (obj_name == "DhcpDdns")) {
+ // Candidates for deprecated.
+ continue;
+ }
+ if (obj_name == "Control-agent") {
+ deprecated.insert(obj_name);
+ continue;
+ }
+ if (obj_name == "Netconf") {
+ obsolete.insert(obj_name);
+ continue;
+ }
+ unknown.insert(obj_name);
+ }
// Relocate Logging.
Daemon::relocateLogging(args, "Dhcp4");
CfgMgr::instance().getStagingCfg()->applyLoggingCfg();
// Log deprecated objects.
+ for (auto name : deprecated) {
+ LOG_WARN(dhcp4_logger, DHCP4_CONFIG_DEPRECATED_OBJECT).arg(name);
+ }
- // Log obsolete objects and return an error.
+ // Log obsolete/unknown objects and return an error.
+ string bad;
+ bool bads = false;
+ for (auto name : obsolete) {
+ LOG_ERROR(dhcp4_logger, DHCP4_CONFIG_OBSOLETE_OBJECT).arg(name);
+ if (bad.empty()) {
+ bad = name;
+ } else {
+ bads = true;
+ }
+ }
+ for (auto name : unknown) {
+ LOG_ERROR(dhcp4_logger, DHCP4_CONFIG_UNKNOWN_OBJECT).arg(name);
+ if (bad.empty()) {
+ bad= name;
+ } else {
+ bads = true;
+ }
+ }
+ if (!obsolete.empty() || !unknown.empty()) {
+ // Rollback logging.
+ CfgMgr::instance().getCurrentCfg()->applyLoggingCfg();
+
+ // Return a failure response.
+ message = "Unsupported object";
+ if (bads) {
+ message += "s";
+ }
+ message = " '" + bad + "'";
+ if (bads) {
+ message += ", ...";
+ }
+ message += " in config";
+ return (isc::config::createAnswer(status_code, message));
+ }
// Now we configure the server proper.
ConstElementPtr result = processConfig(dhcp4);
configuration is committed by the administrator. Additional information
may be provided.
-% DHCP4_CONFIG_DEPRECATED DHCPv4 server configuration includes a deprecated object: %1
+% DHCP4_CONFIG_DEPRECATED_OBJECT DHCPv4 server configuration includes a deprecated object: %1
This warning message is issued when the configuration includes a deprecated
object (i.e. a top level element) which will be ignored.
This is an informational message reporting that the configuration has
been extended to include the specified IPv4 subnet.
-% DHCP4_CONFIG_OBSOLETE DHCPv4 server configuration includes an obsolete object: %1
+% DHCP4_CONFIG_OBSOLETE_OBJECT DHCPv4 server configuration includes an obsolete object: %1
This error message is issued when the configuration includes an obsolete
object (i.e. a top level element).
configuration. That happens at start up and also when a server configuration
change is committed by the administrator.
+% DHCP4_CONFIG_UNKNOWN_OBJECT DHCPv4 server configuration includes an unknown object: %1
+This error message is issued when the configuration includes an unknown
+object (i.e. a top level element).
+
% DHCP4_CONFIG_UPDATE updated configuration received: %1
A debug message indicating that the DHCPv4 server has received an
updated configuration from the Kea configuration system.
// configuration attempts.
CfgMgr::instance().rollback();
- // Check obsolete objects.
-
- // Check deprecated objects.
+ // Check deprecated, obsolete or unknown objects.
+ set<string> deprecated;
+ set<string> obsolete;
+ set<string> unknown;
+ for (auto obj : args->mapValue()) {
+ const string& obj_name = obj.first;
+ if ((obj_name == "Dhcp6") || (obj_name == "Logging")) {
+ continue;
+ }
+ if ((obj_name == "Dhcp4") || (obj_name == "DhcpDdns")) {
+ // Candidates for deprecated.
+ continue;
+ }
+ if (obj_name == "Control-agent") {
+ deprecated.insert(obj_name);
+ continue;
+ }
+ if (obj_name == "Netconf") {
+ obsolete.insert(obj_name);
+ continue;
+ }
+ unknown.insert(obj_name);
+ }
// Relocate Logging.
Daemon::relocateLogging(args, "Dhcp6");
CfgMgr::instance().getStagingCfg()->applyLoggingCfg();
// Log deprecated objects.
+ for (auto name : deprecated) {
+ LOG_WARN(dhcp6_logger, DHCP6_CONFIG_DEPRECATED_OBJECT).arg(name);
+ }
- // Log obsolete objects and return an error.
+ // Log obsolete/unknown objects and return an error.
+ string bad;
+ bool bads = false;
+ for (auto name : obsolete) {
+ LOG_ERROR(dhcp6_logger, DHCP6_CONFIG_OBSOLETE_OBJECT).arg(name);
+ if (bad.empty()) {
+ bad = name;
+ } else {
+ bads = true;
+ }
+ }
+ for (auto name : unknown) {
+ LOG_ERROR(dhcp6_logger, DHCP6_CONFIG_UNKNOWN_OBJECT).arg(name);
+ if (bad.empty()) {
+ bad= name;
+ } else {
+ bads = true;
+ }
+ }
+ if (!obsolete.empty() || !unknown.empty()) {
+ // Rollback logging.
+ CfgMgr::instance().getCurrentCfg()->applyLoggingCfg();
+
+ // Return a failure response.
+ message = "Unsupported object";
+ if (bads) {
+ message += "s";
+ }
+ message = " '" + bad + "'";
+ if (bads) {
+ message += ", ...";
+ }
+ message += " in config";
+ return (isc::config::createAnswer(status_code, message));
+ }
// Now we configure the server proper.
ConstElementPtr result = processConfig(dhcp6);
// Check obsolete objects.
// Relocate Logging. Note this allows to check the loggers configuration.
- Daemon::relocateLogging(args, "Dhcp4");
+ Daemon::relocateLogging(args, "Dhcp6");
// Log obsolete objects and return an error.
configuration is committed by the administrator. Additional information
may be provided.
-% DHCP6_CONFIG_DEPRECATED DHCPv6 server configuration includes a deprecated object: %1
+% DHCP6_CONFIG_DEPRECATED_OBJECT DHCPv6 server configuration includes a deprecated object: %1
This warning message is issued when the configuration includes a deprecated
object (i.e. a top level element) which will be ignored.
will fail to start. If this is a dynamic reconfiguration attempt the
server will continue to use an old configuration.
-% DHCP6_CONFIG_OBSOLETE DHCPv6 server configuration includes an obsolete object: %1
+% DHCP6_CONFIG_OBSOLETE_OBJECT DHCPv6 server configuration includes an obsolete object: %1
This error message is issued when the configuration includes an obsolete
object (i.e. a top level element).
configuration. That happens start up and also when a server configuration
change is committed by the administrator.
+% DHCP6_CONFIG_UNKNOWN_OBJECT DHCPv6 server configuration includes an unknown object: %1
+This error message is issued when the configuration includes an unknown
+object (i.e. a top level element).
+
% DHCP6_CONFIG_UPDATE updated configuration received: %1
A debug message indicating that the IPv6 DHCP server has received an
updated configuration from the Kea configuration system.
" include not map '" << getAppName() << "' entry");
}
- // Check obsolete objects.
+ // Check obsolete or unknown objects.
+ std::set<std::string> unsupported;
+ for (auto obj : whole_config->mapValue()) {
+ const std::string& app_name = getAppName();
+ const std::string& obj_name = obj.first;
+ if ((obj_name == app_name) || (obj_name == "Logging")) {
+ continue;
+ }
+ if ((obj_name == "Dhcp4") || (obj_name == "Dhcp6") ||
+ (obj_name == "Control-agent") || (obj_name == "Netconf")) {
+ if ((app_name == "DhcpDdns") ||
+ (app_name == "Control-agent")) {
+ continue;
+ }
+ if (app_name == "Netconf") {
+ unsupported.insert(obj_name);
+ continue;
+ }
+ }
+ unsupported.insert(obj_name);
+ }
+ if (unsupported.size() == 1) {
+ isc_throw(InvalidUsage, "Unsupported object '"
+ << *unsupported.begin() << "' in config");
+ } else if (unsupported.size() > 1) {
+ isc_throw(InvalidUsage, "Unsupported objects '"
+ << *unsupported.begin() << "', ... in config");
+ }
// Relocate Logging.
Daemon::relocateLogging(whole_config, getAppName());
- // Log obsolete objects and return an error.
-
// Get an application process object.
initProcess();
-# Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2016-2019 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
configuration has failed. The service will start, but will not
process requests until the configuration has been corrected.
-% DCTL_CONFIG_OBSOLETE server configuration includes an obsolete object: %1
+% DCTL_CONFIG_OBSOLETE_OBJECT server configuration includes an obsolete object: %1
This error message is issued when the configuration includes an obsolete
object (i.e. a top level element).
This debug message is issued when the dummy handler for configuration
events is called. This only happens during initial startup.
+% DCTL_CONFIG_UNKNOWN_OBJECT server configuration includes an unknown object: %1
+This error message is issued when the configuration includes an unknown
+object (i.e. a top level element).
+
% DCTL_CONFIG_UPDATE %1 updated configuration received: %2
A debug message indicating that the controller has received an
updated configuration from the Kea configuration system.