From 391da3011c7efe77ecc7a8d990721de0d0c3dc93 Mon Sep 17 00:00:00 2001 From: Tomek Mrugalski Date: Thu, 14 Jul 2016 22:20:24 +0200 Subject: [PATCH] [experiments/yang] Better handling of incoming data. --- src/bin/dhcp6/ctrl_dhcp6_srv.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.cc b/src/bin/dhcp6/ctrl_dhcp6_srv.cc index 6b927d4ba9..dbc23f60f5 100644 --- a/src/bin/dhcp6/ctrl_dhcp6_srv.cc +++ b/src/bin/dhcp6/ctrl_dhcp6_srv.cc @@ -109,18 +109,24 @@ ControlledDhcpv6Srv::commandSetConfigHandler(const string&, // args must be { "Dhcp6": { ... }, "Logging": { ... } } // the Logging component is technically optional, but very recommended. if (!args) { - message = "Missing mandatory 'Dhcp6' parameter."; + message = "Arguments for the set-config command are missing."; } else { - ConstElementPtr dhcp6 = args->get("Dhcp6"); - if (!dhcp6) { - message = "Missing mandatory 'Dhcp6' parameter."; - } else if (dhcp6->getType() != Element::map) { - message = "'Dhcp6' parameter expected to be a map."; + + if (args->getType() != Element::map) { + message = "Arguments are supposed to be a map."; + } else { + dhcp6 = args->get("Dhcp6"); + if (!dhcp6) { + message = "Missing mandatory 'Dhcp6' parameter."; + } else if (dhcp6->getType() != Element::map) { + message = "'Dhcp6' parameter expected to be a map."; + } } } if (!dhcp6) { // Something went wrong, we can't find the Dhcp6 element. + message = "Mandatory 'Dhcp6' map is not specified."; result = isc::config::createAnswer(status_code, message); return (result); } -- 2.47.2