From a790456f1b826ea204f47c4aa4973dc777d00d2a Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Mon, 3 Nov 2014 10:12:52 +0100 Subject: sgsn: Call mm_ctx_cleanup_free to deregister MM context Currently the MM context isn't always removed when it is de-registered (mmctx_timer_cb), mm_state is set to GMM_DEREGISTERED instead. This can lead to left-over MM contexts which are only cleaned up if the MS reattaches. This patch replaces all of these assignments by a call to mm_ctx_cleanup_free. Ticket: OW#1324 Sponsored-by: On-Waves ehf --- openbsc/src/gprs/gprs_gmm.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'openbsc/src/gprs/gprs_gmm.c') diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c index 9f34b4ded..389123d05 100644 --- a/openbsc/src/gprs/gprs_gmm.c +++ b/openbsc/src/gprs/gprs_gmm.c @@ -712,8 +712,6 @@ static int gsm48_rx_gmm_id_resp(struct sgsn_mm_ctx *ctx, struct msgb *msg) "p_tmsi_old=0x%08x\n", ictx->p_tmsi); - ictx->mm_state = GMM_DEREGISTERED; - mm_ctx_cleanup_free(ictx, "GPRS IMSI re-use"); } } @@ -1242,9 +1240,7 @@ static void mmctx_timer_cb(void *_mm) case 3350: /* waiting for ATTACH COMPLETE */ if (mm->num_T_exp >= 5) { LOGMMCTXP(LOGL_NOTICE, mm, "T3350 expired >= 5 times\n"); - mm->mm_state = GMM_DEREGISTERED; - mm->t3350_mode = GMM_T3350_MODE_NONE; - mm->pending_req = 0; + mm_ctx_cleanup_free(mm, "T3350"); /* FIXME: should we return some error? */ break; } @@ -1269,7 +1265,7 @@ static void mmctx_timer_cb(void *_mm) case 3360: /* waiting for AUTH AND CIPH RESP */ if (mm->num_T_exp >= 5) { LOGMMCTXP(LOGL_NOTICE, mm, "T3360 expired >= 5 times\n"); - mm->mm_state = GMM_DEREGISTERED; + mm_ctx_cleanup_free(mm, "T3360"); break; } /* FIXME: re-transmit the respective msg and re-start timer */ @@ -1279,7 +1275,7 @@ static void mmctx_timer_cb(void *_mm) if (mm->num_T_exp >= 5) { LOGMMCTXP(LOGL_NOTICE, mm, "T3370 expired >= 5 times\n"); gsm48_tx_gmm_att_rej(mm, GMM_CAUSE_MS_ID_NOT_DERIVED); - mm->mm_state = GMM_DEREGISTERED; + mm_ctx_cleanup_free(mm, "GPRS ATTACH REJECT (T3370)"); break; } /* re-tranmit IDENTITY REQUEST and re-start timer */ -- cgit v1.2.3