diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-08-25 18:10:42 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-08-25 19:04:24 +0200 |
commit | bfc85e430062a4db13f1af15ffaeedb6eb818959 (patch) | |
tree | cfc14a6fef0cadea740f4eaec3588a07cf750b96 /src/osmo-bsc/osmo_bsc_ctrl.c | |
parent | 551321ec722349fe52d956fef3f41bb01488b7af (diff) |
ctrl: Fix CTRL TRAP for {msc.X,msc_)connection_status not sent
The tx TRAP callback is triggered through a signal which is never sent in
osmo-bsc code, and never was as far as I can tell going quite far in the
logs.
In the meanwhile, the msc_connection_status was left in favour of
multi-msc msc.X.connection_status CTRL variable, so let's prepre the cb
function to work for that onei too, dropping global variables which may lead
to wrong output in multi-msc environments, and simply use msc->nr==0 for
the old variable "msc_connection_status".
The signal is now triggered in a_reset when the A conn becomes connected
or disconnected. As a result, a user waiting for the disconnect event
may notice that the status may be changed with a noticeable delay, since
the A conn may be reset only due to high layer timeouts after several
repeated failures (T4, BAD_CONNECTION_THRESOLD).
Related: OS#2623
Related: OS#4701
Related: SYS#5046
Change-Id: I645d198e8e1acd0aba09d05cb3ae90443946acf8
Diffstat (limited to 'src/osmo-bsc/osmo_bsc_ctrl.c')
-rw-r--r-- | src/osmo-bsc/osmo_bsc_ctrl.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/osmo-bsc/osmo_bsc_ctrl.c b/src/osmo-bsc/osmo_bsc_ctrl.c index 5ebe59789..05bc86c2b 100644 --- a/src/osmo-bsc/osmo_bsc_ctrl.c +++ b/src/osmo-bsc/osmo_bsc_ctrl.c @@ -195,7 +195,6 @@ static int get_msc_connection_status(struct ctrl_cmd *cmd, void *data) /* Backwards compat. */ CTRL_CMD_DEFINE_RO(msc0_connection_status, "msc_connection_status"); -static int msc_connection_status = 0; /* XXX unused */ static int get_msc0_connection_status(struct ctrl_cmd *cmd, void *data) { @@ -214,13 +213,12 @@ static int msc_connection_status_trap_cb(unsigned int subsys, unsigned int signa { struct ctrl_cmd *cmd; struct gsm_network *gsmnet = (struct gsm_network *)handler_data; + struct bsc_msc_data *msc = (struct bsc_msc_data *)signal_data; - if (signal == S_MSC_LOST && msc_connection_status == 1) { + if (signal == S_MSC_LOST) { LOGP(DCTRL, LOGL_DEBUG, "MSC connection lost, sending TRAP.\n"); - msc_connection_status = 0; - } else if (signal == S_MSC_CONNECTED && msc_connection_status == 0) { + } else if (signal == S_MSC_CONNECTED) { LOGP(DCTRL, LOGL_DEBUG, "MSC connection (re)established, sending TRAP.\n"); - msc_connection_status = 1; } else { return 0; } @@ -232,12 +230,19 @@ static int msc_connection_status_trap_cb(unsigned int subsys, unsigned int signa } cmd->id = "0"; - cmd->variable = "msc_connection_status"; + cmd->variable = talloc_asprintf(cmd, "msc.%d.connection_status", msc->nr); + cmd->node = msc; - get_msc0_connection_status(cmd, NULL); + get_msc_connection_status(cmd, NULL); ctrl_cmd_send_to_all(gsmnet->ctrl, cmd); + if (msc->nr == 0) { + /* Backwards compat. */ + cmd->variable = "msc_connection_status"; + ctrl_cmd_send_to_all(gsmnet->ctrl, cmd); + } + talloc_free(cmd); return 0; |