[PATCH] ctrl: Fix handling of missing replies

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Holger Hans Peter Freyther holger at freyther.de
Thu May 15 19:24:58 UTC 2014


On Thu, May 15, 2014 at 01:04:14PM +0200, Jacob Erlbeck wrote:
> Currently, if a CTRL method does not set the reply, an error is
> logged ("cmd->reply has not been set"). It even complains when the
> function implementing the command returns CTRL_CMD_HANDLED, where
> a reply text is not needed.
> 
> This patch changes the logging level from ERROR to NOTICE. The logging
> is now only done, when the retry has not been set and the

			    ^^^^^^ <- reply?

> implementation returns either CTRL_CMD_ERROR or CTRL_CMD_REPLY. So
> in these cases the reply field must be set.

> -		if (ret == CTRL_CMD_ERROR)
> +		if (ret == CTRL_CMD_ERROR) {
>  			cmd->reply = "An error has occured.";
> -		else
> +			LOGP(DCTRL, LOGL_NOTICE,
> +			     "%s: cmd->reply has not been set (ERROR).\n",
> +			     cmd->variable);
> +		} else if (ret == CTRL_CMD_REPLY) {
> +			LOGP(DCTRL, LOGL_NOTICE,
> +			     "%s: cmd->reply has not been set (type = %d).\n",
> +			     cmd->variable, cmd->type);
> +			cmd->reply = "";
> +		} else {
>  			cmd->reply = "Command has been handled.";

Is using a switch/case better here? So for CTRL_CMD_HANDLED the
"Command has been handled" will be set?




More information about the OpenBSC mailing list