diff options
author | Razvan Becheriu <razvan@isc.org> | 2020-12-10 18:24:13 +0100 |
---|---|---|
committer | Razvan Becheriu <razvan@isc.org> | 2021-01-22 18:15:19 +0100 |
commit | 144b7b65d8ff6f0c3503a73f48998310cf8d7e6d (patch) | |
tree | 26f3228bef1300d554dd3cfe0baeeea19a17b8e7 /src/bin/dhcp4 | |
parent | [#1601] use internal state to differentiate between actors affecting the netw... (diff) | |
download | kea-144b7b65d8ff6f0c3503a73f48998310cf8d7e6d.tar.xz kea-144b7b65d8ff6f0c3503a73f48998310cf8d7e6d.zip |
[#1601] added handle-id to dhcp-enable/dhcp-disable
Diffstat (limited to 'src/bin/dhcp4')
-rw-r--r-- | src/bin/dhcp4/ctrl_dhcp4_srv.cc | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.cc b/src/bin/dhcp4/ctrl_dhcp4_srv.cc index af15fbbe23..8bea0fce97 100644 --- a/src/bin/dhcp4/ctrl_dhcp4_srv.cc +++ b/src/bin/dhcp4/ctrl_dhcp4_srv.cc @@ -490,11 +490,12 @@ ControlledDhcpv4Srv::commandDhcpDisableHandler(const std::string&, ConstElementPtr args) { std::ostringstream message; int64_t max_period = 0; - int64_t handle_id = 0; + std::string handle_id; NetworkState::ControllerType type = NetworkState::COMMAND; - // Parse arguments to see if the 'max-period' parameter has been specified. + // Parse arguments to see if the 'max-period' of 'handle-id' parameters have + // been specified. if (args) { // Arguments must be a map. if (args->getType() != Element::map) { @@ -524,16 +525,12 @@ ControlledDhcpv4Srv::commandDhcpDisableHandler(const std::string&, ConstElementPtr handle_id_element = args->get("handle-id"); // handle-id is optional. if (handle_id_element) { - // It must be an integer, if specified. - if (handle_id_element->getType() != Element::integer) { - message << "'handle-id' argument must be a number"; + // It must be a string, if specified. + if (handle_id_element->getType() != Element::string) { + message << "'handle-id' argument must be a string"; } else { - // It must be positive integer. - handle_id = handle_id_element->intValue(); - if (handle_id <= 0) { - message << "'handle-id' must be positive integer"; - } + handle_id = handle_id_element->stringValue(); type = NetworkState::HA; } } @@ -560,11 +557,11 @@ ConstElementPtr ControlledDhcpv4Srv::commandDhcpEnableHandler(const std::string&, ConstElementPtr args) { std::ostringstream message; - int64_t handle_id = 0; + std::string handle_id; NetworkState::ControllerType type = NetworkState::COMMAND; - // Parse arguments to see if the 'max-period' parameter has been specified. + // Parse arguments to see if the 'handle-id' parameter has been specified. if (args) { // Arguments must be a map. if (args->getType() != Element::map) { @@ -574,16 +571,12 @@ ControlledDhcpv4Srv::commandDhcpEnableHandler(const std::string&, ConstElementPtr handle_id_element = args->get("handle-id"); // handle-id is optional. if (handle_id_element) { - // It must be an integer, if specified. - if (handle_id_element->getType() != Element::integer) { - message << "'handle-id' argument must be a number"; + // It must be a string, if specified. + if (handle_id_element->getType() != Element::string) { + message << "'handle-id' argument must be a string"; } else { - // It must be positive integer. - handle_id = handle_id_element->intValue(); - if (handle_id <= 0) { - message << "'handle-id' must be positive integer"; - } + handle_id = handle_id_element->stringValue(); type = NetworkState::HA; } } |