<p>daniel has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-gbproxy/+/23684">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">gb_proxy: Ensure cell info is up to date when receiving PTP-BVC reset<br><br>When a BSS resets its BVC and reuses a BVCI with a differente cell id<br>the SGSN BVC still has the old cell information.<br><br>This results in the SGSN receiving a BVC reset for the old cell which in<br>turn leads to all sorts of issues (probably also with paging) and<br>conflicting information since the cell info is also present in the<br>UL-UNITDATA and this is just passed through from the BSS.<br><br>Instead of reusing the old BVC on the SGSN side free any existing and create<br>new ones.<br><br>Change-Id: Ia94090a0133340b7b284df6ec5b36546da698b37<br>---<br>M src/gb_proxy.c<br>1 file changed, 23 insertions(+), 16 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-gbproxy refs/changes/84/23684/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/gb_proxy.c b/src/gb_proxy.c</span><br><span>index c01c5c6..64b1397 100644</span><br><span>--- a/src/gb_proxy.c</span><br><span>+++ b/src/gb_proxy.c</span><br><span>@@ -685,26 +685,33 @@</span><br><span>           bvc->cell->bss_bvc = bvc;</span><br><span>      }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   /* allocate (any missing) SGSN-side BVCs within the cell, and reset them */</span><br><span style="color: hsl(120, 100%, 40%);">+   /* Ensure we have the correct RA/CELL ID */</span><br><span style="color: hsl(120, 100%, 40%);">+   if (!gsm48_ra_equal(&bvc->cell->id.raid, ra_id)) {</span><br><span style="color: hsl(120, 100%, 40%);">+          LOGPBVC(bvc, LOGL_NOTICE, "RAID changed from %s to %s, updating cell\n", osmo_rai_name(&bvc->cell->id.raid), osmo_rai_name(ra_id));</span><br><span style="color: hsl(120, 100%, 40%);">+               memcpy(&bvc->cell->id.raid, ra_id, sizeof(*ra_id));</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+     if (bvc->cell->id.cid != cell_id) {</span><br><span style="color: hsl(120, 100%, 40%);">+             LOGPBVC(bvc, LOGL_NOTICE, "CellID changed from %05d to %05d, updating cell\n", bvc->cell->id.cid, cell_id);</span><br><span style="color: hsl(120, 100%, 40%);">+           bvc->cell->id.cid = cell_id;</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%);">+   /* Reallocate SGSN-side BVCs of the cell, and reset them</span><br><span style="color: hsl(120, 100%, 40%);">+       * Removing and reallocating is needed becaus the ra_id/cell_id might have changed */</span><br><span>        hash_for_each(cfg->sgsn_nses, i, sgsn_nse, list) {</span><br><span>                struct gbproxy_bvc *sgsn_bvc = gbproxy_bvc_by_bvci(sgsn_nse, bvci);</span><br><span>          if (sgsn_bvc)</span><br><span style="color: hsl(0, 100%, 40%);">-                   OSMO_ASSERT(sgsn_bvc->cell == bvc->cell || !sgsn_bvc->cell);</span><br><span style="color: hsl(120, 100%, 40%);">+                 gbproxy_bvc_free(sgsn_bvc);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-         if (!sgsn_bvc) {</span><br><span style="color: hsl(0, 100%, 40%);">-                        sgsn_bvc = gbproxy_bvc_alloc(sgsn_nse, bvci);</span><br><span style="color: hsl(0, 100%, 40%);">-                   OSMO_ASSERT(sgsn_bvc);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-                  sgsn_bvc->cell = bvc->cell;</span><br><span style="color: hsl(0, 100%, 40%);">-                       memcpy(&sgsn_bvc->raid, &bvc->cell->id.raid, sizeof(sgsn_bvc->raid));</span><br><span style="color: hsl(0, 100%, 40%);">-                       sgsn_bvc->fi = bssgp_bvc_fsm_alloc_ptp_bss(sgsn_bvc, cfg->nsi, sgsn_nse->nsei,</span><br><span style="color: hsl(0, 100%, 40%);">-                                                            bvci, ra_id, cell_id);</span><br><span style="color: hsl(0, 100%, 40%);">-                       OSMO_ASSERT(sgsn_bvc->fi);</span><br><span style="color: hsl(0, 100%, 40%);">-                   bssgp_bvc_fsm_set_max_pdu_len(sgsn_bvc->fi, sgsn_nse->max_sdu_len);</span><br><span style="color: hsl(0, 100%, 40%);">-                       bssgp_bvc_fsm_set_ops(sgsn_bvc->fi, &sgsn_ptp_bvc_fsm_ops, sgsn_bvc);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-                    gbproxy_cell_add_sgsn_bvc(bvc->cell, sgsn_bvc);</span><br><span style="color: hsl(0, 100%, 40%);">-              }</span><br><span style="color: hsl(120, 100%, 40%);">+             sgsn_bvc = gbproxy_bvc_alloc(sgsn_nse, bvci);</span><br><span style="color: hsl(120, 100%, 40%);">+         OSMO_ASSERT(sgsn_bvc);</span><br><span style="color: hsl(120, 100%, 40%);">+                sgsn_bvc->cell = bvc->cell;</span><br><span style="color: hsl(120, 100%, 40%);">+             memcpy(&sgsn_bvc->raid, &bvc->cell->id.raid, sizeof(sgsn_bvc->raid));</span><br><span style="color: hsl(120, 100%, 40%);">+             sgsn_bvc->fi = bssgp_bvc_fsm_alloc_ptp_bss(sgsn_bvc, cfg->nsi, sgsn_nse->nsei,</span><br><span style="color: hsl(120, 100%, 40%);">+                                                          bvci, ra_id, cell_id);</span><br><span style="color: hsl(120, 100%, 40%);">+             OSMO_ASSERT(sgsn_bvc->fi);</span><br><span style="color: hsl(120, 100%, 40%);">+         bssgp_bvc_fsm_set_max_pdu_len(sgsn_bvc->fi, sgsn_nse->max_sdu_len);</span><br><span style="color: hsl(120, 100%, 40%);">+             bssgp_bvc_fsm_set_ops(sgsn_bvc->fi, &sgsn_ptp_bvc_fsm_ops, sgsn_bvc);</span><br><span style="color: hsl(120, 100%, 40%);">+          gbproxy_cell_add_sgsn_bvc(bvc->cell, sgsn_bvc);</span><br><span>   }</span><br><span> </span><br><span>        /* Trigger outbound BVC-RESET procedure toward each SGSN */</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-gbproxy/+/23684">change 23684</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-gbproxy/+/23684"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-gbproxy </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ia94090a0133340b7b284df6ec5b36546da698b37 </div>
<div style="display:none"> Gerrit-Change-Number: 23684 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: daniel <dwillmann@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>