<p>dexter has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/26197">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">abis_nm: actively block BTSs with invalid configuration<br><br>At the moment the BTS configuration is checked, but the check does not<br>have much consequence other than that some initialization that is not<br>executed. The BTS will go into the OML bootstrap phase anyway and most<br>likely fail at some later point due to the invalid configuration. To<br>reduce noise and unexpected behaviour of the BTS lets make sure that the<br>OML boostrap phase can only proceed when the BSC conciders the<br>configuration as valid.<br><br>Change-Id: I42c1c26a9b800600787b1266a871f95f2114c26e<br>Related: OS#5369<br>---<br>M include/osmocom/bsc/bts.h<br>M src/osmo-bsc/abis_nm.c<br>M src/osmo-bsc/osmo_bsc_main.c<br>3 files changed, 22 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/97/26197/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h</span><br><span>index 7e73acd..2150060 100644</span><br><span>--- a/include/osmocom/bsc/bts.h</span><br><span>+++ b/include/osmocom/bsc/bts.h</span><br><span>@@ -284,6 +284,10 @@</span><br><span>         /* Geographical location of the BTS */</span><br><span>       struct llist_head loc_list;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+       /* Flag to indicate that this BTS has a valid configuration set.</span><br><span style="color: hsl(120, 100%, 40%);">+       * This flag is set by check_bts() in osmo_bsc_main.c. */</span><br><span style="color: hsl(120, 100%, 40%);">+     bool valid_config;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>         /* number of this BTS in network */</span><br><span>  uint8_t nr;</span><br><span>  /* human readable name / description */</span><br><span>diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c</span><br><span>index 7c04394..cdab587 100644</span><br><span>--- a/src/osmo-bsc/abis_nm.c</span><br><span>+++ b/src/osmo-bsc/abis_nm.c</span><br><span>@@ -931,6 +931,21 @@</span><br><span>  struct gsm_bts *bts = sign_link->trx->bts;</span><br><span>     int ret = 0;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+      /* Check if this BTS has a valid configuration. If not we will inhibit the BTS</span><br><span style="color: hsl(120, 100%, 40%);">+         * from booting with invalid configuration values by rejecting any OML messages</span><br><span style="color: hsl(120, 100%, 40%);">+        * comming from the BTS. */</span><br><span style="color: hsl(120, 100%, 40%);">+   if (!bts->valid_config) {</span><br><span style="color: hsl(120, 100%, 40%);">+          struct nm_nack_signal_data nack_data;</span><br><span style="color: hsl(120, 100%, 40%);">+         LOGPFOH(DNM, LOGL_NOTICE, foh, "(bts=%u) BTS configuration inavlid, rejecting OML NM Message from BTS -- check and correct configuratin!\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                        bts->nr);</span><br><span style="color: hsl(120, 100%, 40%);">+          nack_data.msg = mb;</span><br><span style="color: hsl(120, 100%, 40%);">+           nack_data.mt = mt;</span><br><span style="color: hsl(120, 100%, 40%);">+            nack_data.bts = bts;</span><br><span style="color: hsl(120, 100%, 40%);">+          osmo_signal_dispatch(SS_NM, S_NM_NACK, &nack_data);</span><br><span style="color: hsl(120, 100%, 40%);">+               abis_nm_queue_send_next(bts);</span><br><span style="color: hsl(120, 100%, 40%);">+         return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  /* check for unsolicited message */</span><br><span>  if (is_report(mt))</span><br><span>           return abis_nm_rcvmsg_report(mb, bts);</span><br><span>diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c</span><br><span>index a2d367b..573376a 100644</span><br><span>--- a/src/osmo-bsc/osmo_bsc_main.c</span><br><span>+++ b/src/osmo-bsc/osmo_bsc_main.c</span><br><span>@@ -396,6 +396,8 @@</span><br><span>    if (!bts->model)</span><br><span>          return -EFAULT;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+   bts->valid_config = false;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>      switch (bts->band) {</span><br><span>      case GSM_BAND_1800:</span><br><span>          if (bts->c0->arfcn < 512 || bts->c0->arfcn > 885) {</span><br><span>@@ -436,6 +438,7 @@</span><br><span>          }</span><br><span>    }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ bts->valid_config = true;</span><br><span>         return 0;</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bsc/+/26197">change 26197</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/c/osmo-bsc/+/26197"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bsc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I42c1c26a9b800600787b1266a871f95f2114c26e </div>
<div style="display:none"> Gerrit-Change-Number: 26197 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>