aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2020-09-18 15:37:56 +0200
committerlaforge <laforge@osmocom.org>2020-09-20 09:52:24 +0000
commit27a0bf70e74895824bbf9559ff9403ab8859a2b5 (patch)
treeb7657acb11d69c9c510ffce5e67e2f86219acb50
parentd3c3ddeb51a16366055ed5bc9bf9935c60db58cc (diff)
gmm: on invalid RA id reject the MS with an implicit detach
As long the SGSN doesn't support PS handover treat unknown RA as invalid and do an implicit detach. Fixes ttcn3 crash when an RAU happen within an Attach Request Change-Id: I6a0b335d51f58c26349f7e0a62b2107d7d351d07
-rw-r--r--src/sgsn/gprs_gmm.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/sgsn/gprs_gmm.c b/src/sgsn/gprs_gmm.c
index 182276cf..86545f85 100644
--- a/src/sgsn/gprs_gmm.c
+++ b/src/sgsn/gprs_gmm.c
@@ -1663,16 +1663,26 @@ static int gsm48_rx_gmm_ra_upd_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
} else if (!gprs_ra_id_equals(&mmctx->ra, &old_ra_id) ||
mmctx->gmm_fsm->state == ST_GMM_DEREGISTERED)
{
- /* We cannot use the mmctx */
- LOGMMCTXP(LOGL_INFO, mmctx,
- "The MM context cannot be used, RA: %s\n",
- osmo_rai_name(&mmctx->ra));
- /* mmctx is set to NULL and gprs_llgmm_unassign(llme) will be
- called below, let's make sure we don't keep dangling llme
- pointers in mmctx (OS#3957, OS#4245). */
- if (mmctx->ran_type == MM_CTX_T_GERAN_Gb)
- mmctx->gb.llme = NULL;
- mmctx = NULL;
+ /* We've received either a RAU for a MS which isn't registered
+ * or a RAU with an unknown RA ID. As long the SGSN doesn't support
+ * PS handover we treat this as invalid RAU */
+ struct gprs_ra_id new_ra_id;
+ char new_ra[32];
+
+ bssgp_parse_cell_id(&new_ra_id, msgb_bcid(msg));
+ osmo_rai_name_buf(new_ra, sizeof(new_ra), &new_ra_id);
+
+ if (mmctx->gmm_fsm->state == ST_GMM_DEREGISTERED)
+ LOGMMCTXP(LOGL_INFO, mmctx,
+ "Rejecting RAU - GMM state is deregistered. Old RA: %s New RA: %s\n",
+ osmo_rai_name(&old_ra_id), new_ra);
+ else
+ LOGMMCTXP(LOGL_INFO, mmctx,
+ "Rejecting RAU - Old RA doesn't match MM. Old RA: %s New RA: %s\n",
+ osmo_rai_name(&old_ra_id), new_ra);
+
+ reject_cause = GMM_CAUSE_IMPL_DETACHED;
+ goto rejected;
}
if (!mmctx) {