From 40ad91330d6ceb9d429ad5943128b2faf5bfa0f0 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 12 Jul 2018 17:41:55 +0200 Subject: 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 --- src/ctrl/control_cmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/ctrl') 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; -- cgit v1.2.3