aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-10-31 12:27:11 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2014-11-03 10:21:20 +0100
commit645c3beddb25f94ef4172a112645df07613a75ff (patch)
treee6a8b31fc2f5b391ec36b4c55b1888689f79cac4
parented7938ffd98223b708c1e03b8501e4e42821bc41 (diff)
sgsn: Fix LLME leak when forcing a reattach
Currently when forceing a reattach by sending a Detach Request (reattach), the SGSN waits for the Detach Accept until it frees the MM context (if present) and the LLME. If that message gets lost or isn't sent by the MS, the LLME is never freed if it isn't bound to an MM context. This patch adds code to free the MM context/LLME when forcing a reattachment. Sponsored-by: On-Waves ehf
-rw-r--r--openbsc/src/gprs/gprs_gmm.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index 711981680..575ad7965 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -1153,7 +1153,12 @@ static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
}
/* Force the MS to re-attach */
- return sgsn_force_reattach_oldmsg(msg);
+ rc = sgsn_force_reattach_oldmsg(msg);
+
+ /* TLLI unassignment */
+ gprs_llgmm_assign(llme, llme->tlli, 0xffffffff,
+ GPRS_ALGO_GEA0, NULL);
+ return rc;
}
switch (gh->msg_type) {
@@ -1705,15 +1710,12 @@ int gsm0408_gprs_force_reattach(struct sgsn_mm_ctx *mmctx)
int rc;
gprs_llgmm_reset(mmctx->llme);
- /* Delete all existing PDP contexts for this MS */
- delete_pdp_contexts(mmctx, "forced reattach");
+ rc = gsm48_tx_gmm_detach_req(
+ mmctx, GPRS_DET_T_MT_REATT_REQ, GMM_CAUSE_IMPL_DETACHED);
- /* TODO:
- * properly start detach procedure (timeout, wait for ACK) and
- * do nothing if a re-attach is in progress */
+ mm_ctx_cleanup_free(mmctx, "forced reattach");
- return gsm48_tx_gmm_detach_req(
- mmctx, GPRS_DET_T_MT_REATT_REQ, GMM_CAUSE_IMPL_DETACHED);
+ return rc;
}
/* Main entry point for incoming 04.08 GPRS messages */