diff options
author | Stefan Sperling <ssperling@sysmocom.de> | 2018-05-07 14:13:41 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-05-15 20:58:06 +0000 |
commit | 5a0f85d00b749a75f3d101e7f860bffea6270084 (patch) | |
tree | da278f2df3b7ccbc1b778b6fd948730e14b0b752 /src | |
parent | 33da462a2bf37f2688d79530b11f9e65b5c93502 (diff) |
let osmo-bts log a special notice if OML connection is closed early
A frequent configuration file error is that the unit_id settings of
osmo-bts and osmo-bsc don't match. The BSC already prints an error
in this case. Let the BTS print an error as well.
We use a heuristic for this purpose: If the OML link is dropped within
10 seconds after being established, log a special warning which alerts
the user and recommend a manual configuration file check.
Change-Id: I476ac797458b5a46edea3ae9cfbd491fd7f77f47
Related: OS#3143
Diffstat (limited to 'src')
-rw-r--r-- | src/common/abis.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/common/abis.c b/src/common/abis.c index 6aa2f1d1..21240b84 100644 --- a/src/common/abis.c +++ b/src/common/abis.c @@ -31,6 +31,7 @@ #include <errno.h> #include <string.h> #include <stdlib.h> +#include <inttypes.h> #include <osmocom/core/select.h> #include <osmocom/core/timer.h> @@ -108,6 +109,9 @@ static struct e1inp_sign_link *sign_link_up(void *unit, struct e1inp_line *line, sign_link = g_bts->oml_link = e1inp_sign_link_create(&line->ts[E1INP_SIGN_OML-1], E1INP_SIGN_OML, NULL, 255, 0); + if (clock_gettime(CLOCK_MONOTONIC, &g_bts->oml_conn_established_timestamp) != 0) + memset(&g_bts->oml_conn_established_timestamp, 0, + sizeof(g_bts->oml_conn_established_timestamp)); drain_oml_queue(g_bts); sign_link->trx = g_bts->c0; bts_link_estab(g_bts); @@ -140,9 +144,22 @@ static void sign_link_down(struct e1inp_line *line) LOGP(DABIS, LOGL_ERROR, "Signalling link down\n"); /* First remove the OML signalling link */ - if (g_bts->oml_link) + if (g_bts->oml_link) { + struct timespec now; + e1inp_sign_link_destroy(g_bts->oml_link); + + /* Log a special notice if the OML connection was dropped relatively quickly. */ + if (g_bts->oml_conn_established_timestamp.tv_sec != 0 && clock_gettime(CLOCK_MONOTONIC, &now) == 0 && + g_bts->oml_conn_established_timestamp.tv_sec + OSMO_BTS_OML_CONN_EARLY_DISCONNECT >= now.tv_sec) { + LOGP(DABIS, LOGL_FATAL, "OML link was closed early within %" PRIu64 " seconds. " + "If this situation persists, please check your BTS and BSC configuration files for errors. " + "A common error is a mismatch between unit_id configuration parameters of BTS and BSC.\n", + (uint64_t)(now.tv_sec - g_bts->oml_conn_established_timestamp.tv_sec)); + } + } g_bts->oml_link = NULL; + memset(&g_bts->oml_conn_established_timestamp, 0, sizeof(g_bts->oml_conn_established_timestamp)); /* Then iterate over the RSL signalling links */ llist_for_each_entry(trx, &g_bts->trx_list, list) { |