Change in openbsc[master]: nat: ctrl: Avoid sending back received ERROR msgs
Pau Espin Pedrol has submitted this change and it was merged. ( 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(-) Approvals: Harald Welte: Looks good to me, approved Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c b/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c index 7a5e9d0..152929c 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c @@ -111,13 +111,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, _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(>cfg->lac_list)) { @@ -152,11 +153,14 @@ ctrl_cmd_send(>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: merged Gerrit-Change-Id: I7b4d20aea7a16c4b4e5add7c274a4ed34a7f6b8d Gerrit-Change-Number: 9980 Gerrit-PatchSet: 3 Gerrit-Owner: Pau Espin Pedrol Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Pau Espin Pedrol
Change in openbsc[master]: nat: ctrl: Avoid sending back received ERROR msgs
Harald Welte has posted comments on this change. ( https://gerrit.osmocom.org/9980 ) Change subject: nat: ctrl: Avoid sending back received ERROR msgs .. Patch Set 3: Code-Review+2 -- 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: comment Gerrit-Change-Id: I7b4d20aea7a16c4b4e5add7c274a4ed34a7f6b8d Gerrit-Change-Number: 9980 Gerrit-PatchSet: 3 Gerrit-Owner: Pau Espin Pedrol Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Comment-Date: Fri, 13 Jul 2018 05:01:46 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in openbsc[master]: nat: ctrl: Avoid sending back received ERROR msgs
Neels Hofmeyr has posted comments on this change. ( https://gerrit.osmocom.org/9980 ) Change subject: nat: ctrl: Avoid sending back received ERROR msgs .. Patch Set 2: Code-Review+2 -- 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: comment Gerrit-Change-Id: I7b4d20aea7a16c4b4e5add7c274a4ed34a7f6b8d Gerrit-Change-Number: 9980 Gerrit-PatchSet: 2 Gerrit-Owner: Pau Espin Pedrol Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Comment-Date: Thu, 12 Jul 2018 18:30:22 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in openbsc[master]: nat: ctrl: Avoid sending back received ERROR msgs
Neels Hofmeyr has posted comments on this change. ( https://gerrit.osmocom.org/9980 ) Change subject: nat: ctrl: Avoid sending back received ERROR msgs .. Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/9980/2//COMMIT_MSG Commit Message: https://gerrit.osmocom.org/#/c/9980/2//COMMIT_MSG@13 PS2, Line 13: Related: OS#3394 Depends: ... -- 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: comment Gerrit-Change-Id: I7b4d20aea7a16c4b4e5add7c274a4ed34a7f6b8d Gerrit-Change-Number: 9980 Gerrit-PatchSet: 2 Gerrit-Owner: Pau Espin Pedrol Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Pau Espin Pedrol Gerrit-CC: Neels Hofmeyr Gerrit-Comment-Date: Thu, 12 Jul 2018 18:26:12 + Gerrit-HasComments: Yes Gerrit-HasLabels: No
Change in openbsc[master]: nat: ctrl: Avoid sending back received ERROR msgs
Pau Espin Pedrol has posted comments on this change. ( https://gerrit.osmocom.org/9980 ) Change subject: nat: ctrl: Avoid sending back received ERROR msgs .. Patch Set 1: Requires libosmocore https://gerrit.osmocom.org/#/c/libosmocore/+/9978/ to build correctly. -- 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: comment Gerrit-Change-Id: I7b4d20aea7a16c4b4e5add7c274a4ed34a7f6b8d Gerrit-Change-Number: 9980 Gerrit-PatchSet: 1 Gerrit-Owner: Pau Espin Pedrol Gerrit-Reviewer: Pau Espin Pedrol Gerrit-CC: Jenkins Builder Gerrit-Comment-Date: Thu, 12 Jul 2018 16:41:42 + Gerrit-HasComments: No Gerrit-HasLabels: No
Change in openbsc[master]: nat: ctrl: Avoid sending back received ERROR msgs
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, _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(>cfg->lac_list)) { @@ -142,11 +143,14 @@ ctrl_cmd_send(>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