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
This commit is contained in:
Neels Hofmeyr 2023-03-24 03:33:21 +01:00
parent 9425640d7f
commit 01389592b2
1 changed files with 5 additions and 7 deletions

View File

@ -469,13 +469,11 @@ static int hnbgw_rx_hnb_register_req(struct hnb_context *ctx, ANY_t *in)
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;