laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/21474 )


Change subject: gb_proxy: Slightly restructure processing of BSS-originated 
BVC-RESET
......................................................................

gb_proxy: Slightly restructure processing of BSS-originated BVC-RESET

* explicit else clause rather than implicit
* don't continue processing if mandatory BVCI missing from message

Change-Id: I038576b91ae1ece149149d8663de7b8495d24e06
---
M src/gbproxy/gb_proxy.c
1 file changed, 24 insertions(+), 21 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/74/21474/1

diff --git a/src/gbproxy/gb_proxy.c b/src/gbproxy/gb_proxy.c
index 4f2aa2d..2fd276d 100644
--- a/src/gbproxy/gb_proxy.c
+++ b/src/gbproxy/gb_proxy.c
@@ -1014,31 +1014,34 @@
                                        int *copy_to_sgsn2)
 {
        struct gbproxy_peer *from_peer = NULL;
+       uint16_t bvci;

-       /* If we receive a BVC reset on the signalling endpoint, we
-        * don't want the SGSN to reset, as the signalling endpoint
-        * is common for all point-to-point BVCs (and thus all BTS) */
-       if (TLVP_PRESENT(tp, BSSGP_IE_BVCI)) {
-               uint16_t bvci = ntohs(tlvp_val16_unal(tp, BSSGP_IE_BVCI));
-               LOGP(DGPRS, LOGL_INFO, "NSE(%05u) Rx BVC RESET (BVCI=%05u)\n", 
nsei, bvci);
-               if (bvci == 0) {
-                       struct gbproxy_nse *nse;
-                       /* Ensure the NSE peer is there and clear all PtP BVCs 
*/
-                       nse = gbproxy_nse_by_nsei_or_new(cfg, nsei);
-                       if (!nse) {
-                               LOGP(DGPRS, LOGL_ERROR, "Could not create 
NSE(%05u)\n", nsei);
-                               bssgp_tx_status(BSSGP_CAUSE_PROTO_ERR_UNSPEC, 
0, msg);
-                               return 0;
-                       }
+       if (!TLVP_PRESENT(tp, BSSGP_IE_BVCI))
+               return 0;

-                       gbproxy_cleanup_peers(cfg, nsei, 0);
-
-                       /* FIXME: only do this if SGSN is alive! */
-                       LOGPNSE(nse, LOGL_INFO, "Tx fake "
-                               "BVC RESET ACK of BVCI=0\n");
-                       bssgp_tx_simple_bvci(BSSGP_PDUT_BVC_RESET_ACK, nsei, 0, 
0);
+       bvci = ntohs(tlvp_val16_unal(tp, BSSGP_IE_BVCI));
+       LOGP(DGPRS, LOGL_INFO, "NSE(%05u) Rx BVC RESET (BVCI=%05u)\n", nsei, 
bvci);
+       if (bvci == 0) {
+               /* If we receive a BVC reset on the signalling endpoint, we
+                * don't want the SGSN to reset, as the signalling endpoint
+                * is common for all point-to-point BVCs (and thus all BTS) */
+               struct gbproxy_nse *nse;
+               /* Ensure the NSE peer is there and clear all PtP BVCs */
+               nse = gbproxy_nse_by_nsei_or_new(cfg, nsei);
+               if (!nse) {
+                       LOGP(DGPRS, LOGL_ERROR, "Could not create NSE(%05u)\n", 
nsei);
+                       bssgp_tx_status(BSSGP_CAUSE_PROTO_ERR_UNSPEC, 0, msg);
                        return 0;
                }
+
+               gbproxy_cleanup_peers(cfg, nsei, 0);
+
+               /* FIXME: only do this if SGSN is alive! */
+               LOGPNSE(nse, LOGL_INFO, "Tx fake "
+                       "BVC RESET ACK of BVCI=0\n");
+               bssgp_tx_simple_bvci(BSSGP_PDUT_BVC_RESET_ACK, nsei, 0, 0);
+               return 0;
+       } else {
                from_peer = gbproxy_peer_by_bvci(cfg, bvci);
                if (!from_peer) {
                        struct gbproxy_nse *nse = gbproxy_nse_by_nsei(cfg, 
nsei);

--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/21474
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I038576b91ae1ece149149d8663de7b8495d24e06
Gerrit-Change-Number: 21474
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <lafo...@osmocom.org>
Gerrit-MessageType: newchange

Reply via email to