<p>laforge <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-sgsn/+/21689">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">gbproxy: (Re)allocate SGSN-side PTP BVC even if CELL already exists<br><br>After a SGSN-side RESET of the SIG-BVC, all PTP BVC on the SGSN side<br>are gone.  However, the CELLs and the BSS side BVCs continue to exist<br>(as there may be other SGSNs).<br><br>So if a PTP-BVC RESET from the BSS side arrives in such a situation,<br>and we can find a matching CELL, we still need to check if we need<br>to create any SGSN-side PTP BVCs instead of simply being happy with<br>the CELLs already existing.<br><br>Change-Id: I1d1562e421082fa4399c73ac31290e4c95718e49<br>Closes: OS#4903<br>---<br>M src/gbproxy/gb_proxy.c<br>1 file changed, 17 insertions(+), 19 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/gbproxy/gb_proxy.c b/src/gbproxy/gb_proxy.c</span><br><span>index 0dd45d4..5e6f238 100644</span><br><span>--- a/src/gbproxy/gb_proxy.c</span><br><span>+++ b/src/gbproxy/gb_proxy.c</span><br><span>@@ -479,6 +479,7 @@</span><br><span> {</span><br><span>         struct gbproxy_bvc *bvc = priv;</span><br><span>      struct gbproxy_config *cfg = bvc->nse->cfg;</span><br><span style="color: hsl(120, 100%, 40%);">+     struct gbproxy_nse *sgsn_nse;</span><br><span>        unsigned int i;</span><br><span> </span><br><span>  OSMO_ASSERT(bvci != 0);</span><br><span>@@ -502,7 +503,6 @@</span><br><span>        }</span><br><span> </span><br><span>        if (!bvc->cell) {</span><br><span style="color: hsl(0, 100%, 40%);">-            struct gbproxy_nse *sgsn_nse;</span><br><span>                /* if we end up here, it means this is the first time we received a BVC-RESET</span><br><span>                 * for this BVC.  We need to create the 'cell' data structure and the SGSN-side</span><br><span>               * BVC counterparts */</span><br><span>@@ -513,28 +513,26 @@</span><br><span> </span><br><span>           /* link us to the cell and vice-versa */</span><br><span>             bvc->cell->bss_bvc = bvc;</span><br><span style="color: hsl(120, 100%, 40%);">+       }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-           /* allocate the SGSN-side BVCs within the cell, and reset them */</span><br><span style="color: hsl(0, 100%, 40%);">-               hash_for_each(cfg->sgsn_nses, i, sgsn_nse, list) {</span><br><span style="color: hsl(0, 100%, 40%);">-                   struct gbproxy_bvc *sgsn_bvc = gbproxy_bvc_by_bvci(sgsn_nse, bvci);</span><br><span style="color: hsl(0, 100%, 40%);">-                     if (sgsn_bvc)</span><br><span style="color: hsl(0, 100%, 40%);">-                           OSMO_ASSERT(!sgsn_bvc->cell);</span><br><span style="color: hsl(120, 100%, 40%);">+      /* allocate (any missing) SGSN-side BVCs within the cell, and reset them */</span><br><span style="color: hsl(120, 100%, 40%);">+   hash_for_each(cfg->sgsn_nses, i, sgsn_nse, list) {</span><br><span style="color: hsl(120, 100%, 40%);">+         struct gbproxy_bvc *sgsn_bvc = gbproxy_bvc_by_bvci(sgsn_nse, bvci);</span><br><span style="color: hsl(120, 100%, 40%);">+           if (sgsn_bvc)</span><br><span style="color: hsl(120, 100%, 40%);">+                 OSMO_ASSERT(sgsn_bvc->cell == bvc->cell || !sgsn_bvc->cell);</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(120, 100%, 40%);">+                if (!sgsn_bvc) {</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> </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->ra, bvc->cell->ra, sizeof(sgsn_bvc->ra));</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_ops(sgsn_bvc->fi, &sgsn_ptp_bvc_fsm_ops, 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->ra, bvc->cell->ra, sizeof(sgsn_bvc->ra));</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_ops(sgsn_bvc->fi, &sgsn_ptp_bvc_fsm_ops, sgsn_bvc);</span><br><span> </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%);">-                      } else {</span><br><span style="color: hsl(0, 100%, 40%);">-                                OSMO_ASSERT(sgsn_bvc->cell == bvc->cell);</span><br><span style="color: hsl(0, 100%, 40%);">-                 }</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> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-sgsn/+/21689">change 21689</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-sgsn/+/21689"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-sgsn </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I1d1562e421082fa4399c73ac31290e4c95718e49 </div>
<div style="display:none"> Gerrit-Change-Number: 21689 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>