<p>Harald Welte <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/8056">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">let osmo-bts log a special notice if OML connection is closed early<br><br>A frequent configuration file error is that the unit_id settings of<br>osmo-bts and osmo-bsc don't match. The BSC already prints an error<br>in this case. Let the BTS print an error as well.<br><br>We use a heuristic for this purpose: If the OML link is dropped within<br>10 seconds after being established, log a special warning which alerts<br>the user and recommend a manual configuration file check.<br><br>Change-Id: I476ac797458b5a46edea3ae9cfbd491fd7f77f47<br>Related: OS#3143<br>---<br>M include/osmo-bts/gsm_data_shared.h<br>M src/common/abis.c<br>2 files changed, 23 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmo-bts/gsm_data_shared.h b/include/osmo-bts/gsm_data_shared.h</span><br><span>index 812d086..81cac3e 100644</span><br><span>--- a/include/osmo-bts/gsm_data_shared.h</span><br><span>+++ b/include/osmo-bts/gsm_data_shared.h</span><br><span>@@ -514,6 +514,10 @@</span><br><span>  uint8_t initial_mcs;</span><br><span> };</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* The amount of time within which a sudden disconnect of a newly established</span><br><span style="color: hsl(120, 100%, 40%);">+ * OML connection will cause a special warning to be logged. */</span><br><span style="color: hsl(120, 100%, 40%);">+#define OSMO_BTS_OML_CONN_EARLY_DISCONNECT 10    /* in seconds */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* One BTS */</span><br><span> struct gsm_bts {</span><br><span>     /* list header in net->bts_list */</span><br><span>@@ -552,6 +556,7 @@</span><br><span>  /* how do we talk OML with this TRX? */</span><br><span>      uint8_t oml_tei;</span><br><span>     struct e1inp_sign_link *oml_link;</span><br><span style="color: hsl(120, 100%, 40%);">+     struct timespec oml_conn_established_timestamp;</span><br><span> </span><br><span>  /* Abis network management O&M handle */</span><br><span>         struct abis_nm_h *nmh;</span><br><span>diff --git a/src/common/abis.c b/src/common/abis.c</span><br><span>index 6aa2f1d..21240b8 100644</span><br><span>--- a/src/common/abis.c</span><br><span>+++ b/src/common/abis.c</span><br><span>@@ -31,6 +31,7 @@</span><br><span> #include <errno.h></span><br><span> #include <string.h></span><br><span> #include <stdlib.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <inttypes.h></span><br><span> </span><br><span> #include <osmocom/core/select.h></span><br><span> #include <osmocom/core/timer.h></span><br><span>@@ -108,6 +109,9 @@</span><br><span>          sign_link = g_bts->oml_link =</span><br><span>                     e1inp_sign_link_create(&line->ts[E1INP_SIGN_OML-1],</span><br><span>                                           E1INP_SIGN_OML, NULL, 255, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+                if (clock_gettime(CLOCK_MONOTONIC, &g_bts->oml_conn_established_timestamp) != 0)</span><br><span style="color: hsl(120, 100%, 40%);">+                       memset(&g_bts->oml_conn_established_timestamp, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+                             sizeof(g_bts->oml_conn_established_timestamp));</span><br><span>            drain_oml_queue(g_bts);</span><br><span>              sign_link->trx = g_bts->c0;</span><br><span>            bts_link_estab(g_bts);</span><br><span>@@ -140,9 +144,22 @@</span><br><span>        LOGP(DABIS, LOGL_ERROR, "Signalling link down\n");</span><br><span> </span><br><span>     /* First remove the OML signalling link */</span><br><span style="color: hsl(0, 100%, 40%);">-      if (g_bts->oml_link)</span><br><span style="color: hsl(120, 100%, 40%);">+       if (g_bts->oml_link) {</span><br><span style="color: hsl(120, 100%, 40%);">+             struct timespec now;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>               e1inp_sign_link_destroy(g_bts->oml_link);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+                /* Log a special notice if the OML connection was dropped relatively quickly. */</span><br><span style="color: hsl(120, 100%, 40%);">+              if (g_bts->oml_conn_established_timestamp.tv_sec != 0 && clock_gettime(CLOCK_MONOTONIC, &now) == 0 &&</span><br><span style="color: hsl(120, 100%, 40%);">+              g_bts->oml_conn_established_timestamp.tv_sec + OSMO_BTS_OML_CONN_EARLY_DISCONNECT >= now.tv_sec) {</span><br><span style="color: hsl(120, 100%, 40%);">+                  LOGP(DABIS, LOGL_FATAL, "OML link was closed early within %" PRIu64 " seconds. "</span><br><span style="color: hsl(120, 100%, 40%);">+                  "If this situation persists, please check your BTS and BSC configuration files for errors. "</span><br><span style="color: hsl(120, 100%, 40%);">+                        "A common error is a mismatch between unit_id configuration parameters of BTS and BSC.\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                  (uint64_t)(now.tv_sec - g_bts->oml_conn_established_timestamp.tv_sec));</span><br><span style="color: hsl(120, 100%, 40%);">+            }</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span>    g_bts->oml_link = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+    memset(&g_bts->oml_conn_established_timestamp, 0, sizeof(g_bts->oml_conn_established_timestamp));</span><br><span> </span><br><span>      /* Then iterate over the RSL signalling links */</span><br><span>     llist_for_each_entry(trx, &g_bts->trx_list, list) {</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/8056">change 8056</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/8056"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bts </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I476ac797458b5a46edea3ae9cfbd491fd7f77f47 </div>
<div style="display:none"> Gerrit-Change-Number: 8056 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: Stefan Sperling <ssperling@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: Stefan Sperling <ssperling@sysmocom.de> </div>