deletes the definition of the option associated with "server1", having the
code of 1 and belonging to the option space "isc". The default option spaces are
"dhcp4" and "dhcp6" for the DHCPv4 and DHCPv6 top-level options, respectively. If
-there is no such option explicitly associated with "server1", no option is
-deleted. To delete an option belonging to "all" servers, the keyword
-"all" must be used as the server tag. The ``server-tags`` list must contain exactly
-one tag and cannot include the ``null`` value.
+there is no such option definition explicitly associated with "server1", no option
+definition is deleted. To delete an option definition belonging to "all" servers,
+the keyword "all" must be used as the server tag. The ``server-tags`` list must
+contain exactly one tag and cannot include the ``null`` value.
+
+As of Kea 3.1.2, before deleting an option definition, the server will first
+check if there are any options specified that depend upon that defintion. If
+so the delete command will be rejected with an error message explaining why.
+This default behavior may be overridden by ihcluding an optional ``force``
+parameter as shown below:
+
+.. code-block:: json
+
+ {
+ "command": "remote-option-def6-del",
+ "arguments": {
+ "option-defs": [
+ {
+ "code": 1,
+ "space": "isc",
+ "force": true
+ }
+ ],
+ "remote": {
+ "type": "mysql"
+ },
+ "server-tags": [ "server1" ]
+ }
+ }
+
+.. note::
+
+ The ``force`` parameter should only be used after careful consideration.
+ Removing an option definition while a dependent option specfication exists
+ will cause that option to be excluded from the running configuration.
+ This parameter is provided to handle use cases where a definition may
+ need to be corrected while leaving the option in place.
.. isccmd:: remote-option-def4-get
.. _command-remote-option-def4-get:
#include <dhcpsrv/cfg_option.h>
#include <dhcp/dhcp6.h>
#include <dhcp/option_space.h>
+#include <dhcpsrv/dhcpsrv_log.h>
#include <util/encode/encode.h>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <vector>
using namespace isc::data;
+using namespace isc::log;
namespace isc {
namespace dhcp {
// based on the given definitions.
for (auto const& space : getOptionSpaceNames()) {
for (auto opt_desc : *(getAll(space))) {
- if (createDescriptorOption(cfg_def, space, opt_desc)) {
- // Option was recreated, let's replace the descriptor.
- replace(opt_desc, space);
+ try {
+ if (createDescriptorOption(cfg_def, space, opt_desc)) {
+ // Option was recreated, let's replace the descriptor.
+ replace(opt_desc, space);
+ }
+ } catch (const InvalidOperation& ex) {
+ LOG_WARN(dhcpsrv_logger, DHCPSRV_CFGMGR_OPTION_DEFINITION_MISMATCH)
+ .arg(ex.what());
}
}
}
extern const isc::log::MessageID DHCPSRV_CFGMGR_IP_RESERVATIONS_UNIQUE_DUPLICATES_POSSIBLE = "DHCPSRV_CFGMGR_IP_RESERVATIONS_UNIQUE_DUPLICATES_POSSIBLE";
extern const isc::log::MessageID DHCPSRV_CFGMGR_NEW_SUBNET4 = "DHCPSRV_CFGMGR_NEW_SUBNET4";
extern const isc::log::MessageID DHCPSRV_CFGMGR_NEW_SUBNET6 = "DHCPSRV_CFGMGR_NEW_SUBNET6";
+extern const isc::log::MessageID DHCPSRV_CFGMGR_OPTION_DEFINITION_MISMATCH = "DHCPSRV_CFGMGR_OPTION_DEFINITION_MISMATCH";
extern const isc::log::MessageID DHCPSRV_CFGMGR_OPTION_DUPLICATE = "DHCPSRV_CFGMGR_OPTION_DUPLICATE";
extern const isc::log::MessageID DHCPSRV_CFGMGR_RENEW_GTR_REBIND = "DHCPSRV_CFGMGR_RENEW_GTR_REBIND";
extern const isc::log::MessageID DHCPSRV_CFGMGR_SOCKET_RAW_UNSUPPORTED = "DHCPSRV_CFGMGR_SOCKET_RAW_UNSUPPORTED";
"DHCPSRV_CFGMGR_IP_RESERVATIONS_UNIQUE_DUPLICATES_POSSIBLE", "setting \"ip-reservations-unique\" from false to true poses a risk that some host backends may still contain multiple reservations for the same IP address",
"DHCPSRV_CFGMGR_NEW_SUBNET4", "a new subnet has been added to configuration: %1",
"DHCPSRV_CFGMGR_NEW_SUBNET6", "a new subnet has been added to configuration: %1",
+ "DHCPSRV_CFGMGR_OPTION_DEFINITION_MISMATCH", "failed to create option: %1",
"DHCPSRV_CFGMGR_OPTION_DUPLICATE", "multiple options with the code: %1 added to the subnet: %2",
"DHCPSRV_CFGMGR_RENEW_GTR_REBIND", "in %1, the value of renew-timer %2 is greater than the value of rebind-timer %3, ignoring renew-timer",
"DHCPSRV_CFGMGR_SOCKET_RAW_UNSUPPORTED", "use of raw sockets is unsupported on this OS, UDP sockets will be used",
extern const isc::log::MessageID DHCPSRV_CFGMGR_IP_RESERVATIONS_UNIQUE_DUPLICATES_POSSIBLE;
extern const isc::log::MessageID DHCPSRV_CFGMGR_NEW_SUBNET4;
extern const isc::log::MessageID DHCPSRV_CFGMGR_NEW_SUBNET6;
+extern const isc::log::MessageID DHCPSRV_CFGMGR_OPTION_DEFINITION_MISMATCH;
extern const isc::log::MessageID DHCPSRV_CFGMGR_OPTION_DUPLICATE;
extern const isc::log::MessageID DHCPSRV_CFGMGR_RENEW_GTR_REBIND;
extern const isc::log::MessageID DHCPSRV_CFGMGR_SOCKET_RAW_UNSUPPORTED;
does not comply with the supported path. The server will
still use the specified path but is warning that doing so may
pose a security risk.
+
+% DHCPSRV_CFGMGR_OPTION_DEFINITION_MISMATCH failed to create option: %1
+This warning message is issued when an option has been specified for which
+there is no suitable option definition. Either there is no defintion at all
+or the option contents do not fit the option defintion. The argument will
+provide a detailed reason for the failure. The server will continue to
+operate but it will exclude the option from packet processing until the
+situation is corrected. This is considered a configuration error.