<p>Stefan Sperling has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/10170">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">clear GPRS indicator in SI3 while PCU is disconnected<br><br>osmo-bts cannot provide GPRS service while osmo-pcu is not connected.<br>The BSC has no knowledge of the PCU connection state. Prevent MMs<br>from trying to register for GPRS while the PCU is disconnected by<br>erasing the GPRS Indicator in SI3.<br><br>Change-Id: I1a6f5c636c0fe098ee31c280d4572a3f8122b44b<br>Related: OS#3075<br>---<br>M src/common/rsl.c<br>1 file changed, 171 insertions(+), 6 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/70/10170/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/common/rsl.c b/src/common/rsl.c</span><br><span>index a24c444..556ecb0 100644</span><br><span>--- a/src/common/rsl.c</span><br><span>+++ b/src/common/rsl.c</span><br><span>@@ -285,6 +285,151 @@</span><br><span>  * common channel releated messages</span><br><span>  */</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* Parsed representation of si3 rest octets. */</span><br><span style="color: hsl(120, 100%, 40%);">+struct gsm48_si3_rest {</span><br><span style="color: hsl(120, 100%, 40%);">+ uint8_t                         sp;</span><br><span style="color: hsl(120, 100%, 40%);">+   uint8_t                         sp_cbq;</span><br><span style="color: hsl(120, 100%, 40%);">+       uint8_t                         sp_cro;</span><br><span style="color: hsl(120, 100%, 40%);">+       uint8_t                         sp_to;</span><br><span style="color: hsl(120, 100%, 40%);">+        uint8_t                         sp_pt;</span><br><span style="color: hsl(120, 100%, 40%);">+        uint8_t                         po;</span><br><span style="color: hsl(120, 100%, 40%);">+   uint8_t                         po_value;</span><br><span style="color: hsl(120, 100%, 40%);">+     uint8_t                         si2ter_ind;</span><br><span style="color: hsl(120, 100%, 40%);">+   uint8_t                         ecsm;</span><br><span style="color: hsl(120, 100%, 40%);">+ uint8_t                         sched;</span><br><span style="color: hsl(120, 100%, 40%);">+        uint8_t                         sched_where;</span><br><span style="color: hsl(120, 100%, 40%);">+  uint8_t                         gprs;</span><br><span style="color: hsl(120, 100%, 40%);">+ uint8_t                         gprs_ra_colour;</span><br><span style="color: hsl(120, 100%, 40%);">+       uint8_t                         gprs_si13_pos;</span><br><span style="color: hsl(120, 100%, 40%);">+        uint8_t                         ecmr_3g;</span><br><span style="color: hsl(120, 100%, 40%);">+      uint8_t                         si2qter_ind;</span><br><span style="color: hsl(120, 100%, 40%);">+};</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/* decode "SI 3 Rest Octets" (10.5.2.34); XXX move to libosmocore? */</span><br><span style="color: hsl(120, 100%, 40%);">+static void gsm48_decode_si3_rest(struct gsm48_si3_rest *s, uint8_t *si,</span><br><span style="color: hsl(120, 100%, 40%);">+ uint8_t len)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+       struct bitvec bv;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   memset(&bv, 0, sizeof(bv));</span><br><span style="color: hsl(120, 100%, 40%);">+       bv.data_len = len;</span><br><span style="color: hsl(120, 100%, 40%);">+    bv.data = si;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       /* Optional Selection Parameters */</span><br><span style="color: hsl(120, 100%, 40%);">+   if (bitvec_get_bit_high(&bv) == H) {</span><br><span style="color: hsl(120, 100%, 40%);">+              s->sp = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+         s->sp_cbq = bitvec_get_uint(&bv, 1);</span><br><span style="color: hsl(120, 100%, 40%);">+           s->sp_cro = bitvec_get_uint(&bv, 6);</span><br><span style="color: hsl(120, 100%, 40%);">+           s->sp_to = bitvec_get_uint(&bv, 3);</span><br><span style="color: hsl(120, 100%, 40%);">+            s->sp_pt = bitvec_get_uint(&bv, 5);</span><br><span style="color: hsl(120, 100%, 40%);">+    } else</span><br><span style="color: hsl(120, 100%, 40%);">+                s->sp = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Optional Power Offset */</span><br><span style="color: hsl(120, 100%, 40%);">+   if (bitvec_get_bit_high(&bv) == H) {</span><br><span style="color: hsl(120, 100%, 40%);">+              s->po = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+         s->po_value = bitvec_get_uint(&bv, 2);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else</span><br><span style="color: hsl(120, 100%, 40%);">+                s->po = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ /* System Information 2ter Indicator */</span><br><span style="color: hsl(120, 100%, 40%);">+       if (bitvec_get_bit_high(&bv) == H)</span><br><span style="color: hsl(120, 100%, 40%);">+                s->si2ter_ind = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ else</span><br><span style="color: hsl(120, 100%, 40%);">+          s->si2ter_ind = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Early Classmark Sending Control */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (bitvec_get_bit_high(&bv) == H)</span><br><span style="color: hsl(120, 100%, 40%);">+                s->ecsm = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+       else</span><br><span style="color: hsl(120, 100%, 40%);">+          s->ecsm = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+       /* Scheduling if and where */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (bitvec_get_bit_high(&bv) == H) {</span><br><span style="color: hsl(120, 100%, 40%);">+              s->sched = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+              s->sched_where = bitvec_get_uint(&bv, 3);</span><br><span style="color: hsl(120, 100%, 40%);">+      } else</span><br><span style="color: hsl(120, 100%, 40%);">+                s->sched = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+      /* GPRS Indicator */</span><br><span style="color: hsl(120, 100%, 40%);">+  if (bitvec_get_bit_high(&bv) == H) {</span><br><span style="color: hsl(120, 100%, 40%);">+              s->gprs = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+               s->gprs_ra_colour = bitvec_get_uint(&bv, 3);</span><br><span style="color: hsl(120, 100%, 40%);">+           s->gprs_si13_pos = bitvec_get_uint(&bv, 1);</span><br><span style="color: hsl(120, 100%, 40%);">+    } else</span><br><span style="color: hsl(120, 100%, 40%);">+                s->gprs = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+       /* 3G Early Classmark Sending Restriction. If H, then controlled by</span><br><span style="color: hsl(120, 100%, 40%);">+    * early_cm_ctrl above */</span><br><span style="color: hsl(120, 100%, 40%);">+     if (bitvec_get_bit_high(&bv) == H)</span><br><span style="color: hsl(120, 100%, 40%);">+                s->ecmr_3g = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+    else</span><br><span style="color: hsl(120, 100%, 40%);">+          s->ecmr_3g = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  if (bitvec_get_bit_high(&bv) == H)</span><br><span style="color: hsl(120, 100%, 40%);">+                s->si2qter_ind = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+        else</span><br><span style="color: hsl(120, 100%, 40%);">+          s->si2qter_ind = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/* encode "SI 3 Rest Octets" (10.5.2.34); XXX move to libosmocore? */</span><br><span style="color: hsl(120, 100%, 40%);">+static void gsm48_encode_si3_rest(struct gsm48_si3_rest *s, uint8_t *si,</span><br><span style="color: hsl(120, 100%, 40%);">+        uint8_t len)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+       struct bitvec bv;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   memset(&bv, 0, sizeof(bv));</span><br><span style="color: hsl(120, 100%, 40%);">+       bv.data = si;</span><br><span style="color: hsl(120, 100%, 40%);">+ bv.data_len = len;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  /* Optional Selection Parameters */</span><br><span style="color: hsl(120, 100%, 40%);">+   if (s->sp) {</span><br><span style="color: hsl(120, 100%, 40%);">+               bitvec_set_bit(&bv, H);</span><br><span style="color: hsl(120, 100%, 40%);">+           bitvec_set_bit(&bv, s->sp_cbq);</span><br><span style="color: hsl(120, 100%, 40%);">+                bitvec_set_uint(&bv, s->sp_cro, 6);</span><br><span style="color: hsl(120, 100%, 40%);">+            bitvec_set_uint(&bv, s->sp_to, 3);</span><br><span style="color: hsl(120, 100%, 40%);">+             bitvec_set_uint(&bv, s->sp_pt, 5);</span><br><span style="color: hsl(120, 100%, 40%);">+     } else</span><br><span style="color: hsl(120, 100%, 40%);">+                bitvec_set_bit(&bv, L);</span><br><span style="color: hsl(120, 100%, 40%);">+   /* Optional Power Offset */</span><br><span style="color: hsl(120, 100%, 40%);">+   if (s->po) {</span><br><span style="color: hsl(120, 100%, 40%);">+               bitvec_set_bit(&bv, H);</span><br><span style="color: hsl(120, 100%, 40%);">+           bitvec_set_uint(&bv, s->po_value, 2);</span><br><span style="color: hsl(120, 100%, 40%);">+  } else</span><br><span style="color: hsl(120, 100%, 40%);">+                bitvec_set_bit(&bv, L);</span><br><span style="color: hsl(120, 100%, 40%);">+   /* System Information 2ter Indicator */</span><br><span style="color: hsl(120, 100%, 40%);">+       if (s->si2ter_ind)</span><br><span style="color: hsl(120, 100%, 40%);">+         bitvec_set_bit(&bv, H);</span><br><span style="color: hsl(120, 100%, 40%);">+   else</span><br><span style="color: hsl(120, 100%, 40%);">+          bitvec_set_bit(&bv, L);</span><br><span style="color: hsl(120, 100%, 40%);">+   /* Early Classmark Sending Control */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (s->ecsm)</span><br><span style="color: hsl(120, 100%, 40%);">+               bitvec_set_bit(&bv, H);</span><br><span style="color: hsl(120, 100%, 40%);">+   else</span><br><span style="color: hsl(120, 100%, 40%);">+          bitvec_set_bit(&bv, L);</span><br><span style="color: hsl(120, 100%, 40%);">+   /* Scheduling if and where */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (s->sched) {</span><br><span style="color: hsl(120, 100%, 40%);">+            bitvec_set_bit(&bv, H);</span><br><span style="color: hsl(120, 100%, 40%);">+           bitvec_set_uint(&bv, s->sched_where, 3);</span><br><span style="color: hsl(120, 100%, 40%);">+       } else</span><br><span style="color: hsl(120, 100%, 40%);">+                bitvec_set_bit(&bv, L);</span><br><span style="color: hsl(120, 100%, 40%);">+   /* GPRS Indicator */</span><br><span style="color: hsl(120, 100%, 40%);">+  if (s->gprs) {</span><br><span style="color: hsl(120, 100%, 40%);">+             bitvec_set_bit(&bv, H);</span><br><span style="color: hsl(120, 100%, 40%);">+           bitvec_set_uint(&bv, s->gprs_ra_colour, 3);</span><br><span style="color: hsl(120, 100%, 40%);">+            /* 0 == SI13 in BCCH Norm, 1 == SI13 sent on BCCH Ext */</span><br><span style="color: hsl(120, 100%, 40%);">+              bitvec_set_bit(&bv, s->gprs_si13_pos);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else</span><br><span style="color: hsl(120, 100%, 40%);">+                bitvec_set_bit(&bv, L);</span><br><span style="color: hsl(120, 100%, 40%);">+   /* 3G Early Classmark Sending Restriction. If H, then controlled by</span><br><span style="color: hsl(120, 100%, 40%);">+    * early_cm_ctrl above */</span><br><span style="color: hsl(120, 100%, 40%);">+     if (s->ecmr_3g)</span><br><span style="color: hsl(120, 100%, 40%);">+            bitvec_set_bit(&bv, L);</span><br><span style="color: hsl(120, 100%, 40%);">+   else</span><br><span style="color: hsl(120, 100%, 40%);">+          bitvec_set_bit(&bv, H);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (s->si2qter_ind) {</span><br><span style="color: hsl(120, 100%, 40%);">+              bitvec_set_bit(&bv, H); /* indicator struct present */</span><br><span style="color: hsl(120, 100%, 40%);">+            bitvec_set_uint(&bv, 0, 1); /* message is sent on BCCH Norm */</span><br><span style="color: hsl(120, 100%, 40%);">+    }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   bitvec_spare_padding(&bv, (bv.data_len*8)-1);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* 8.5.1 BCCH INFOrmation is received */</span><br><span> static int rsl_rx_bcch_info(struct gsm_bts_trx *trx, struct msgb *msg)</span><br><span> {</span><br><span>@@ -356,12 +501,32 @@</span><br><span> </span><br><span>                bts->si_valid |= (1 << osmo_si);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-           if (SYSINFO_TYPE_3 == osmo_si && trx->nr == 0 &&</span><br><span style="color: hsl(0, 100%, 40%);">-                 num_agch(trx, "RSL") != 1) {</span><br><span style="color: hsl(0, 100%, 40%);">-                      lchan_deactivate(&trx->bts->c0->ts[0].lchan[CCCH_LCHAN]);</span><br><span style="color: hsl(0, 100%, 40%);">-                  /* will be reactivated by sapi_deactivate_cb() */</span><br><span style="color: hsl(0, 100%, 40%);">-                       trx->bts->c0->ts[0].lchan[CCCH_LCHAN].rel_act_kind =</span><br><span style="color: hsl(0, 100%, 40%);">-                           LCHAN_REL_ACT_REACT;</span><br><span style="color: hsl(120, 100%, 40%);">+          if (SYSINFO_TYPE_3 == osmo_si) {</span><br><span style="color: hsl(120, 100%, 40%);">+                      if (trx->nr == 0 && num_agch(trx, "RSL") != 1) {</span><br><span style="color: hsl(120, 100%, 40%);">+                         lchan_deactivate(&trx->bts->c0->ts[0].lchan[CCCH_LCHAN]);</span><br><span style="color: hsl(120, 100%, 40%);">+                                /* will be reactivated by sapi_deactivate_cb() */</span><br><span style="color: hsl(120, 100%, 40%);">+                             trx->bts->c0->ts[0].lchan[CCCH_LCHAN].rel_act_kind =</span><br><span style="color: hsl(120, 100%, 40%);">+                                 LCHAN_REL_ACT_REACT;</span><br><span style="color: hsl(120, 100%, 40%);">+                  }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+                   /* While osmo-pcu is not connected this BTS cannot provide GPRS service.</span><br><span style="color: hsl(120, 100%, 40%);">+                       * The BSC has no knowledge of our PCU connection state, but we want</span><br><span style="color: hsl(120, 100%, 40%);">+                   * to prevent MMs from trying to register for GPRS through this BTS.</span><br><span style="color: hsl(120, 100%, 40%);">+                   * Thus, we erase the GPRS Indicator in SI3 ourselves. See OS#3075. */</span><br><span style="color: hsl(120, 100%, 40%);">+                        if (!pcu_connected()) {</span><br><span style="color: hsl(120, 100%, 40%);">+                               struct gsm48_system_information_type_3 *si3;</span><br><span style="color: hsl(120, 100%, 40%);">+                          size_t rest_octet_len;</span><br><span style="color: hsl(120, 100%, 40%);">+                                si3 = (struct gsm48_system_information_type_3 *)GSM_BTS_SI(bts, osmo_si);</span><br><span style="color: hsl(120, 100%, 40%);">+                             rest_octet_len = len - offsetof(struct gsm48_system_information_type_3, rest_octets);</span><br><span style="color: hsl(120, 100%, 40%);">+                         if (rest_octet_len > 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                  struct gsm48_si3_rest s;</span><br><span style="color: hsl(120, 100%, 40%);">+                                      gsm48_decode_si3_rest(&s, si3->rest_octets, rest_octet_len);</span><br><span style="color: hsl(120, 100%, 40%);">+                                   if (s.gprs) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                         s.gprs = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+                                           gsm48_encode_si3_rest(&s, si3->rest_octets, rest_octet_len);</span><br><span style="color: hsl(120, 100%, 40%);">+                                   }</span><br><span style="color: hsl(120, 100%, 40%);">+                             }</span><br><span style="color: hsl(120, 100%, 40%);">+                     }</span><br><span>            }</span><br><span> </span><br><span>                if (SYSINFO_TYPE_13 == osmo_si)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/10170">change 10170</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/10170"/><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: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I1a6f5c636c0fe098ee31c280d4572a3f8122b44b </div>
<div style="display:none"> Gerrit-Change-Number: 10170 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Stefan Sperling <ssperling@sysmocom.de> </div>