summaryrefslogtreecommitdiffstats
path: root/src/ctrl
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-07-12 17:41:55 +0200
committerHarald Welte <laforge@gnumonks.org>2018-07-12 18:47:57 +0000
commit40ad91330d6ceb9d429ad5943128b2faf5bfa0f0 (patch)
tree08e3777687d4f12e2cb2af2c81f032a3d51fe720 /src/ctrl
parent55088b76cec00674d2becf7ced4723c5998a0a42 (diff)
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
Diffstat (limited to 'src/ctrl')
-rw-r--r--src/ctrl/control_cmd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ctrl/control_cmd.c b/src/ctrl/control_cmd.c
index c5924b2b..14ff9065 100644
--- a/src/ctrl/control_cmd.c
+++ b/src/ctrl/control_cmd.c
@@ -362,7 +362,8 @@ struct ctrl_cmd *ctrl_cmd_parse2(void *ctx, struct msgb *msg)
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;