summaryrefslogtreecommitdiffstats
path: root/src/ctrl
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2017-02-24 14:48:45 +0100
committerMax <msuraev@sysmocom.de>2017-03-01 16:37:59 +0000
commit2ed3659cac62d240b9c7afc0f03ee08ee9ef8bed (patch)
tree21ee096b3229f4493a1331c2e796da76622e7d9c /src/ctrl
parent70c7d4160dfb9b710e4bf93d3d6265dce8b0392f (diff)
Handle replies in ctrl_cmd_handle()
Previously *_REPLY and ERROR messages were not explicitly handled which would lead to sending error in response to them which in turn would prompt other party to send error as well which would result in infinite cycle. Handle it explicitly by logging message id and other relevant data. Change-Id: Id96f3a2fc81fa4549f49556d83f062c6b2f59e28 Related: OS#1615
Diffstat (limited to 'src/ctrl')
-rw-r--r--src/ctrl/control_if.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c
index de49d160..f49d6399 100644
--- a/src/ctrl/control_if.c
+++ b/src/ctrl/control_if.c
@@ -186,6 +186,23 @@ int ctrl_cmd_handle(struct ctrl_handle *ctrl, struct ctrl_cmd *cmd,
vector vline, cmdvec, cmds_vec;
+ if (cmd->type == CTRL_TYPE_SET_REPLY ||
+ cmd->type == CTRL_TYPE_GET_REPLY) {
+ if (strncmp(cmd->reply, "OK", 2) == 0) {
+ LOGP(DLCTRL, LOGL_DEBUG, "%s <%s> for %s is OK\n",
+ get_value_string(ctrl_type_vals, cmd->type),
+ cmd->id, cmd->variable);
+ return CTRL_CMD_HANDLED;
+ }
+ }
+
+ if (cmd->type == CTRL_TYPE_ERROR) {
+ LOGP(DLCTRL, LOGL_ERROR, "%s <%s> for %s is %s\n",
+ get_value_string(ctrl_type_vals, cmd->type),
+ cmd->id, cmd->variable, cmd->reply);
+ return CTRL_CMD_HANDLED;
+ }
+
ret = CTRL_CMD_ERROR;
cmd->reply = NULL;
node = CTRL_NODE_ROOT;