diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-07-12 18:37:33 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-07-12 20:46:37 +0200 |
commit | b956d323865da7958654bb12de84c24783174bfc (patch) | |
tree | e50a543ca58496c463ce33873a47958333e9d42f /openbsc | |
parent | 746ebf31e1290e85b632369885647bb8ea074c8c (diff) |
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
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c b/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c index 7a5e9d0ca..152929ce2 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 @@ static struct bsc_cmd_list *bsc_get_pending(struct bsc_connection *bsc, char *id 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)) { @@ -152,11 +153,14 @@ int bsc_nat_handle_ctrlif_msg(struct bsc_connection *bsc, struct msgb *msg) 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; |