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
This commit is contained in:
Jacob Erlbeck 2014-11-03 10:12:52 +01:00 committed by Holger Hans Peter Freyther
parent 0074a77424
commit a790456f1b
1 changed files with 3 additions and 7 deletions

View File

@ -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 */