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

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">gb_proxy: Slightly restructure processing of BSS-originated BVC-RESET<br><br>* explicit else clause rather than implicit<br>* don't continue processing if mandatory BVCI missing from message<br><br>Change-Id: I038576b91ae1ece149149d8663de7b8495d24e06<br>---<br>M src/gbproxy/gb_proxy.c<br>1 file changed, 24 insertions(+), 21 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 4f2aa2d..2fd276d 100644</span><br><span>--- a/src/gbproxy/gb_proxy.c</span><br><span>+++ b/src/gbproxy/gb_proxy.c</span><br><span>@@ -1014,31 +1014,34 @@</span><br><span>                                       int *copy_to_sgsn2)</span><br><span> {</span><br><span>     struct gbproxy_peer *from_peer = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+        uint16_t bvci;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-      /* If we receive a BVC reset on the signalling endpoint, we</span><br><span style="color: hsl(0, 100%, 40%);">-      * don't want the SGSN to reset, as the signalling endpoint</span><br><span style="color: hsl(0, 100%, 40%);">-  * is common for all point-to-point BVCs (and thus all BTS) */</span><br><span style="color: hsl(0, 100%, 40%);">-  if (TLVP_PRESENT(tp, BSSGP_IE_BVCI)) {</span><br><span style="color: hsl(0, 100%, 40%);">-          uint16_t bvci = ntohs(tlvp_val16_unal(tp, BSSGP_IE_BVCI));</span><br><span style="color: hsl(0, 100%, 40%);">-              LOGP(DGPRS, LOGL_INFO, "NSE(%05u) Rx BVC RESET (BVCI=%05u)\n", nsei, bvci);</span><br><span style="color: hsl(0, 100%, 40%);">-           if (bvci == 0) {</span><br><span style="color: hsl(0, 100%, 40%);">-                        struct gbproxy_nse *nse;</span><br><span style="color: hsl(0, 100%, 40%);">-                        /* Ensure the NSE peer is there and clear all PtP BVCs */</span><br><span style="color: hsl(0, 100%, 40%);">-                       nse = gbproxy_nse_by_nsei_or_new(cfg, nsei);</span><br><span style="color: hsl(0, 100%, 40%);">-                    if (!nse) {</span><br><span style="color: hsl(0, 100%, 40%);">-                             LOGP(DGPRS, LOGL_ERROR, "Could not create NSE(%05u)\n", nsei);</span><br><span style="color: hsl(0, 100%, 40%);">-                                bssgp_tx_status(BSSGP_CAUSE_PROTO_ERR_UNSPEC, 0, msg);</span><br><span style="color: hsl(0, 100%, 40%);">-                          return 0;</span><br><span style="color: hsl(0, 100%, 40%);">-                       }</span><br><span style="color: hsl(120, 100%, 40%);">+     if (!TLVP_PRESENT(tp, BSSGP_IE_BVCI))</span><br><span style="color: hsl(120, 100%, 40%);">+         return 0;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-                   gbproxy_cleanup_peers(cfg, nsei, 0);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-                    /* FIXME: only do this if SGSN is alive! */</span><br><span style="color: hsl(0, 100%, 40%);">-                     LOGPNSE(nse, LOGL_INFO, "Tx fake "</span><br><span style="color: hsl(0, 100%, 40%);">-                            "BVC RESET ACK of BVCI=0\n");</span><br><span style="color: hsl(0, 100%, 40%);">-                 bssgp_tx_simple_bvci(BSSGP_PDUT_BVC_RESET_ACK, nsei, 0, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+   bvci = ntohs(tlvp_val16_unal(tp, BSSGP_IE_BVCI));</span><br><span style="color: hsl(120, 100%, 40%);">+     LOGP(DGPRS, LOGL_INFO, "NSE(%05u) Rx BVC RESET (BVCI=%05u)\n", nsei, bvci);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (bvci == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+              /* If we receive a BVC reset on the signalling endpoint, we</span><br><span style="color: hsl(120, 100%, 40%);">+            * don't want the SGSN to reset, as the signalling endpoint</span><br><span style="color: hsl(120, 100%, 40%);">+                * is common for all point-to-point BVCs (and thus all BTS) */</span><br><span style="color: hsl(120, 100%, 40%);">+                struct gbproxy_nse *nse;</span><br><span style="color: hsl(120, 100%, 40%);">+              /* Ensure the NSE peer is there and clear all PtP BVCs */</span><br><span style="color: hsl(120, 100%, 40%);">+             nse = gbproxy_nse_by_nsei_or_new(cfg, nsei);</span><br><span style="color: hsl(120, 100%, 40%);">+          if (!nse) {</span><br><span style="color: hsl(120, 100%, 40%);">+                   LOGP(DGPRS, LOGL_ERROR, "Could not create NSE(%05u)\n", nsei);</span><br><span style="color: hsl(120, 100%, 40%);">+                      bssgp_tx_status(BSSGP_CAUSE_PROTO_ERR_UNSPEC, 0, msg);</span><br><span>                       return 0;</span><br><span>            }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+           gbproxy_cleanup_peers(cfg, nsei, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+                /* FIXME: only do this if SGSN is alive! */</span><br><span style="color: hsl(120, 100%, 40%);">+           LOGPNSE(nse, LOGL_INFO, "Tx fake "</span><br><span style="color: hsl(120, 100%, 40%);">+                  "BVC RESET ACK of BVCI=0\n");</span><br><span style="color: hsl(120, 100%, 40%);">+               bssgp_tx_simple_bvci(BSSGP_PDUT_BVC_RESET_ACK, nsei, 0, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+           return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+     } else {</span><br><span>             from_peer = gbproxy_peer_by_bvci(cfg, bvci);</span><br><span>                 if (!from_peer) {</span><br><span>                    struct gbproxy_nse *nse = gbproxy_nse_by_nsei(cfg, nsei);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-sgsn/+/21474">change 21474</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/+/21474"/><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: I038576b91ae1ece149149d8663de7b8495d24e06 </div>
<div style="display:none"> Gerrit-Change-Number: 21474 </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: daniel <dwillmann@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>