diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2014-05-15 13:04:14 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2014-05-15 14:22:56 +0200 |
commit | 268b2e65446fef5c3ddb3bb4423ddf376929e731 (patch) | |
tree | bc833e401a0756f73889e69248a402da1b34b1d2 /openbsc/src/libbsc/bsc_ctrl_lookup.c | |
parent | 47d8f02c068a8ea859630df4b4fd06792b4fd6ef (diff) |
ctrl: Fix handling of missing replies
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
implementation returns either CTRL_CMD_ERROR or CTRL_CMD_REPLY. So
in these cases the reply field must be set.
This fixes the generation of log messages when doing NAT ctrl command
forwarding.
Ticket: OW#1177
Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc/src/libbsc/bsc_ctrl_lookup.c')
-rw-r--r-- | openbsc/src/libbsc/bsc_ctrl_lookup.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/openbsc/src/libbsc/bsc_ctrl_lookup.c b/openbsc/src/libbsc/bsc_ctrl_lookup.c index 338fb1154..3a3df9ca1 100644 --- a/openbsc/src/libbsc/bsc_ctrl_lookup.c +++ b/openbsc/src/libbsc/bsc_ctrl_lookup.c @@ -150,11 +150,19 @@ int bsc_ctrl_cmd_handle(struct ctrl_cmd *cmd, void *data) err: if (!cmd->reply) { - LOGP(DCTRL, LOGL_ERROR, "cmd->reply has not been set.\n"); - 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."; + } } if (ret == CTRL_CMD_ERROR) |