From patchwork Fri May 9 15:25:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Erlbeck X-Patchwork-Id: 347445 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ganesha.gnumonks.org (ganesha.gnumonks.org [213.95.27.120]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9063314007D for ; Sat, 10 May 2014 01:26:26 +1000 (EST) Received: from localhost ([127.0.0.1] helo=ganesha.gnumonks.org) by ganesha.gnumonks.org with esmtp (Exim 4.72) (envelope-from ) id 1Wimgd-0003ZS-8D; Fri, 09 May 2014 17:26:11 +0200 Received: from mail.sysmocom.de ([2a01:4f8:191:444c::2:4]) by ganesha.gnumonks.org with esmtp (Exim 4.72) (envelope-from ) id 1Wimg8-0003Z0-Ry for openbsc@lists.osmocom.org; Fri, 09 May 2014 17:25:46 +0200 Received: from sysmocom-tmp.home (24-134-58-61-dynip.superkabel.de [24.134.58.61]) by mail.sysmocom.de (Postfix) with ESMTPSA id 6ADA15768E; Fri, 9 May 2014 15:25:40 +0000 (UTC) From: Jacob Erlbeck To: openbsc@lists.osmocom.org Subject: [PATCH] ctrl: Fix handling of missing replies Date: Fri, 9 May 2014 17:25:36 +0200 Message-Id: <1399649136-15337-1-git-send-email-jerlbeck@sysmocom.de> X-Mailer: git-send-email 1.7.9.5 X-Spam-Score: 0.0 (/) Cc: Jacob Erlbeck X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Development of the OpenBSC GSM base station controller List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: openbsc-bounces@lists.osmocom.org Errors-To: openbsc-bounces@lists.osmocom.org Currently, if a CTRL method does not set the reply, an error is logged ("cmd->reply has not been set"). This patch changes the logging level from ERROR to INFO. The logging is now only done, when the retry has not been set and the implementation returns CTRL_CMD_ERROR or the GET has been used. This means, every time a error is signalled or GET is used, the retry field shall be set. Some missing reply texts in error cases are also added. Ticket: OW#1177 Sponsored-by: On-Waves ehf --- openbsc/src/libbsc/bsc_ctrl_lookup.c | 11 ++++++++--- openbsc/src/osmo-bsc/osmo_bsc_ctrl.c | 4 +++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/openbsc/src/libbsc/bsc_ctrl_lookup.c b/openbsc/src/libbsc/bsc_ctrl_lookup.c index 338fb11..dced8bd 100644 --- a/openbsc/src/libbsc/bsc_ctrl_lookup.c +++ b/openbsc/src/libbsc/bsc_ctrl_lookup.c @@ -150,10 +150,15 @@ 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, + "cmd->reply has not been set (ERROR).\n"); + } else if (cmd->type == CTRL_TYPE_GET) { + LOGP(DCTRL, LOGL_NOTICE, + "cmd->reply has not been set (GET).\n"); + cmd->reply = ""; + } else cmd->reply = "Command has been handled."; } diff --git a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c index e32218d..3cc704b 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c @@ -72,6 +72,7 @@ static int get_msc_connection_status(struct ctrl_cmd *cmd, void *data) static int set_msc_connection_status(struct ctrl_cmd *cmd, void *data) { + cmd->reply = "Set is unimplemented"; return CTRL_CMD_ERROR; } @@ -128,6 +129,7 @@ static int get_bts_connection_status(struct ctrl_cmd *cmd, void *data) static int set_bts_connection_status(struct ctrl_cmd *cmd, void *data) { + cmd->reply = "Set is unimplemented"; return CTRL_CMD_ERROR; } @@ -522,7 +524,7 @@ static int get_bts_rf_state(struct ctrl_cmd *cmd, void *data) static int set_bts_rf_state(struct ctrl_cmd *cmd, void *data) { - cmd->reply = "set is unimplemented"; + cmd->reply = "Set is unimplemented"; return CTRL_CMD_ERROR; }