Change in openbsc[master]: nat: ctrl: Avoid sending back received ERROR msgs

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 16:41:03 UTC 2018


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


Change subject: nat: ctrl: Avoid sending back received ERROR msgs
......................................................................

nat: ctrl: Avoid sending back received ERROR msgs

We only send back if we had an error parsing the message locally. If we
receive an ERROR message from a bsc, we try to forward it if the ID is
valid, otherwise only log the received error description locally.

Related: OS#3394

Change-Id: I7b4d20aea7a16c4b4e5add7c274a4ed34a7f6b8d
---
M openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c
1 file changed, 11 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/80/9980/1

diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c b/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c
index e244827..e806731 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c
@@ -101,13 +101,14 @@
 int bsc_nat_handle_ctrlif_msg(struct bsc_connection *bsc, struct msgb *msg)
 {
 	struct ctrl_cmd *cmd;
+	bool parse_failed;
 	struct bsc_cmd_list *pending;
 	char *var;
 
-	cmd = ctrl_cmd_parse2(bsc, msg);
+	cmd = ctrl_cmd_parse3(bsc, msg, &parse_failed);
 	msgb_free(msg);
 
-	if (cmd->type == CTRL_TYPE_ERROR)
+	if (cmd->type == CTRL_TYPE_ERROR && parse_failed)
 		goto err;
 
 	if (bsc->cfg && !llist_empty(&bsc->cfg->lac_list)) {
@@ -142,11 +143,14 @@
 			ctrl_cmd_send(&pending->cmd->ccon->write_queue, cmd);
 			bsc_nat_ctrl_del_pending(pending);
 		} else {
-			/* We need to handle TRAPS here */
-			if ((cmd->type != CTRL_TYPE_ERROR) &&
-			    (cmd->type != CTRL_TYPE_TRAP)) {
-				LOGP(DNAT, LOGL_NOTICE, "Got control message "
-					"from BSC without pending entry\n");
+			if ((cmd->type == CTRL_TYPE_ERROR)) {
+				LOGP(DNAT, LOGL_NOTICE, "Got ERROR CTRL message "
+				     "from BSC without pending/valid ID %s: %s\n",
+				     cmd->id, cmd->reply);
+			} else {
+				LOGP(DNAT, LOGL_NOTICE, "Got %s CTRL message "
+				     "from BSC without pending entry\n",
+				     get_value_string(ctrl_type_vals, cmd->type));
 				cmd->type = CTRL_TYPE_ERROR;
 				cmd->reply = "No request outstanding";
 				goto err;

-- 
To view, visit https://gerrit.osmocom.org/9980
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: I7b4d20aea7a16c4b4e5add7c274a4ed34a7f6b8d
Gerrit-Change-Number: 9980
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/7cdec599/attachment.htm>


More information about the gerrit-log mailing list