Change in openbsc[master]: bsc: ctrl: Use ctrl_cmd_parse2 to obtain detailed error

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/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Thu Jul 12 11:38:11 UTC 2018


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/9974


Change subject: bsc: ctrl: Use ctrl_cmd_parse2 to obtain detailed error
......................................................................

bsc: ctrl: Use ctrl_cmd_parse2 to obtain detailed error

Instead of always logging/sending same error, use the new
ctrl_cmd_parse2 API which always returns a cmd structure with a specific
error description.

Change-Id: Ie111bec46b664768fe3c3feff906f91e8ee8b1d4
---
M openbsc/src/osmo-bsc/osmo_bsc_msc.c
1 file changed, 2 insertions(+), 10 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/74/9974/1

diff --git a/openbsc/src/osmo-bsc/osmo_bsc_msc.c b/openbsc/src/osmo-bsc/osmo_bsc_msc.c
index b2f8806..4395c3b 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_msc.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_msc.c
@@ -225,17 +225,9 @@
 	int ret;
 	struct ctrl_cmd *cmd;
 
-	cmd = ctrl_cmd_parse(msc->msc_con, msg);
-	if (!cmd) {
+	cmd = ctrl_cmd_parse2(msc->msc_con, msg);
+	if (cmd->type == CTRL_TYPE_ERROR) {
 		LOGP(DMSC, LOGL_ERROR, "Failed to parse control message.\n");
-		cmd = talloc_zero(msc->msc_con, struct ctrl_cmd);
-		if (!cmd) {
-			LOGP(DMSC, LOGL_ERROR, "OOM!\n");
-			return;
-		}
-		cmd->type = CTRL_TYPE_ERROR;
-		cmd->id = "err";
-		cmd->reply = "Failed to parse control message.";
 
 		ctrl_cmd_send(&msc->msc_con->write_queue, cmd);
 		talloc_free(cmd);

-- 
To view, visit https://gerrit.osmocom.org/9974
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie111bec46b664768fe3c3feff906f91e8ee8b1d4
Gerrit-Change-Number: 9974
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180712/f7a44e25/attachment.htm>


More information about the gerrit-log mailing list