diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-09-22 20:00:16 +0200 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2017-02-23 22:27:38 +0100 |
commit | bc11de962de30b1a6c98689db3fa66c7ad01f639 (patch) | |
tree | ca59439775ff5c50013fb1a4f5c83f47ca46199c /openbsc/src/gprs/gprs_gmm.c | |
parent | c01776257382a692a6f19f9ccb82501db29f6057 (diff) |
sgsn_ranap_iu_event: handle some events without valid MM context
Change-Id: Ia7e74087d56996104b6d3935b1cf12166ff67f3a
Diffstat (limited to 'openbsc/src/gprs/gprs_gmm.c')
-rw-r--r-- | openbsc/src/gprs/gprs_gmm.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c index 1026474a1..9f3b5f18a 100644 --- a/openbsc/src/gprs/gprs_gmm.c +++ b/openbsc/src/gprs/gprs_gmm.c @@ -175,25 +175,33 @@ int sgsn_ranap_iu_event(struct ue_conn_ctx *ctx, enum iu_event_type type, void * int rc = -1; mm = sgsn_mm_ctx_by_ue_ctx(ctx); - if (!mm) { - LOGP(DRANAP, LOGL_NOTICE, "Cannot find mm ctx for IU event %i!\n", type); - return rc; + +#define REQUIRE_MM \ + if (!mm) { \ + LOGP(DRANAP, LOGL_NOTICE, "Cannot find mm ctx for IU event %i!\n", type); \ + return rc; \ } switch (type) { case IU_EVENT_RAB_ASSIGN: + REQUIRE_MM rc = sgsn_ranap_rab_ass_resp(mm, (RANAP_RAB_SetupOrModifiedItemIEs_t *)data); break; case IU_EVENT_IU_RELEASE: /* fall thru */ case IU_EVENT_LINK_INVALIDATED: /* Clean up ue_conn_ctx here */ - LOGMMCTXP(LOGL_INFO, mm, "IU release for imsi %s\n", mm->imsi); - if (mm->pmm_state == PMM_CONNECTED) + if (mm) + LOGMMCTXP(LOGL_INFO, mm, "IU release for imsi %s\n", mm->imsi); + else + LOGMMCTXP(LOGL_INFO, mm, "IU release for UE conn 0x%x\n", + ctx->conn_id); + if (mm && mm->pmm_state == PMM_CONNECTED) mmctx_set_pmm_state(mm, PMM_IDLE); rc = 0; break; case IU_EVENT_SECURITY_MODE_COMPLETE: + REQUIRE_MM /* Continue authentication here */ mm->iu.ue_ctx->integrity_active = 1; rc = gsm48_gmm_authorize(mm); |