ctrl: Fix parsing of ERROR recvd msgs with id=err
Our implementation generates ERROR CTRL messages with ID=error when it
is unable to parse a CMD. However, it doesn't account for them when
trying to receive and parse this kind of message. As a result, it will
return an ERROR message with a different description. This commit fixes
the old behaviour to success at parsing and returning the received
description to the caller.
Change-Id: I564ab1a7e845388f87accda44fbf165e5adc2480
diff --git a/src/ctrl/control_cmd.c b/src/ctrl/control_cmd.c
index c5924b2..14ff906 100644
--- a/src/ctrl/control_cmd.c
+++ b/src/ctrl/control_cmd.c
@@ -362,7 +362,8 @@
goto err;
}
- if (!id_str_valid(tmp)) {
+ if (!id_str_valid(tmp) &&
+ !(cmd->type == CTRL_TYPE_ERROR && strcmp(tmp, "err") == 0)) {
LOGP(DLCTRL, LOGL_NOTICE, "Invalid %s message ID number: \"%s\"\n",
get_value_string(ctrl_type_vals, cmd->type), osmo_escape_str(tmp, -1));
cmd->type = CTRL_TYPE_ERROR;