Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/8056 )

Change subject: let osmo-bts log a special notice if OML connection is closed 
early
......................................................................

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
---
M include/osmo-bts/gsm_data_shared.h
M src/common/abis.c
2 files changed, 23 insertions(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmo-bts/gsm_data_shared.h 
b/include/osmo-bts/gsm_data_shared.h
index 812d086..81cac3e 100644
--- a/include/osmo-bts/gsm_data_shared.h
+++ b/include/osmo-bts/gsm_data_shared.h
@@ -514,6 +514,10 @@
        uint8_t initial_mcs;
 };

+/* The amount of time within which a sudden disconnect of a newly established
+ * OML connection will cause a special warning to be logged. */
+#define OSMO_BTS_OML_CONN_EARLY_DISCONNECT 10   /* in seconds */
+
 /* One BTS */
 struct gsm_bts {
        /* list header in net->bts_list */
@@ -552,6 +556,7 @@
        /* how do we talk OML with this TRX? */
        uint8_t oml_tei;
        struct e1inp_sign_link *oml_link;
+       struct timespec oml_conn_established_timestamp;

        /* Abis network management O&M handle */
        struct abis_nm_h *nmh;
diff --git a/src/common/abis.c b/src/common/abis.c
index 6aa2f1d..21240b8 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 @@
                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 @@
        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) {

--
To view, visit https://gerrit.osmocom.org/8056
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I476ac797458b5a46edea3ae9cfbd491fd7f77f47
Gerrit-Change-Number: 8056
Gerrit-PatchSet: 4
Gerrit-Owner: Stefan Sperling <ssperl...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Stefan Sperling <ssperl...@sysmocom.de>

Reply via email to