neels has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-hnbgw/+/32037 )


Change subject: release UE Contexts on HNB (Re-)Register
......................................................................

release UE Contexts on HNB (Re-)Register

Whenever a HNB reconnects, we want to discard all previous UE state and
any active connections.

In one HNB reconnect scenario, we receive SCTP_RESTART. This sets
hnb_registered == false, which in turn skipped the UE cleanup step in
hnbgw_rx_hnb_register_req(), leaking UE Contexts.

Remove all weird conditions like that, and simply clear out all UE state
whenever a HNB registers, period.

Change-Id: I370966d2d76fd263714e727918fcc1ea2f2315fa
---
M src/osmo-hnbgw/hnbgw_hnbap.c
1 file changed, 24 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/37/32037/1

diff --git a/src/osmo-hnbgw/hnbgw_hnbap.c b/src/osmo-hnbgw/hnbgw_hnbap.c
index 19ebd38..a1cbec5 100644
--- a/src/osmo-hnbgw/hnbgw_hnbap.c
+++ b/src/osmo-hnbgw/hnbgw_hnbap.c
@@ -469,13 +469,11 @@
               ctx->identity_info, ctx->id.mcc, ctx->id.mnc, ctx->id.lac, 
ctx->id.rac, ctx->id.sac, ctx->id.cid,
               name, ctx->hnb_registered ? " (re-connecting)" : "");

-       if (ctx->hnb_registered) {
-               /* The HNB is already registered, and we are seeing a new HNB 
Register Request. The HNB has restarted
-                * without us noticing. Clearly, the HNB does not expect any UE 
state to be active here, so discard any
-                * UE contexts and SCCP connections associated with this HNB. */
-               LOGHNB(ctx, DHNBAP, LOGL_NOTICE, "HNB reconnecting, discarding 
all previous UE state\n");
-               hnb_context_release_ue_state(ctx);
-       }
+       /* The HNB is already registered, and we are seeing a new HNB Register 
Request. The HNB has restarted
+        * without us noticing. Clearly, the HNB does not expect any UE state 
to be active here, so discard any
+        * UE contexts and SCCP connections associated with this HNB. */
+       LOGHNB(ctx, DHNBAP, LOGL_NOTICE, "HNB (re)connecting, discarding all 
previous UE state\n");
+       hnb_context_release_ue_state(ctx);

        ctx->hnb_registered = true;


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

Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I370966d2d76fd263714e727918fcc1ea2f2315fa
Gerrit-Change-Number: 32037
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofm...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to