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
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index 9f34b4d..389123d 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -712,8 +712,6 @@
"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 @@
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 @@
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 @@
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 */