From fb26c60a2faf48339f09b336977eccf3d300cba4 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Wed, 22 Oct 2014 12:20:26 +0200 Subject: sgsn: Avoid duplicated Attach Accept messages Currently each received Ident Resp triggers an Attach Accept/Reject if IMSI and IMEI are known. This has led to duplicated Attach Accept messages when used with the gbproxy (IMSI acquisition active) and with certain mobile equipment (iOS). This patch modifies gsm48_rx_gmm_id_resp to discard Ident Resp messages if all required information (IMEI and IMSI) has been gathered. Ticket: OW#1322 Sponsored-by: On-Waves ehf --- openbsc/src/gprs/gprs_gmm.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (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 c55c300c1..99ab2765c 100644 --- a/openbsc/src/gprs/gprs_gmm.c +++ b/openbsc/src/gprs/gprs_gmm.c @@ -626,6 +626,8 @@ static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx, { if (strlen(ctx->imei) && strlen(ctx->imsi)) { #ifdef PTMSI_ALLOC + ctx->t3370_id_type = GSM_MI_TYPE_NONE; + /* Start T3350 and re-transmit up to 5 times until ATTACH COMPLETE */ ctx->t3350_mode = t3350_mode; mmctx_timer_start(ctx, 3350, GSM0408_T3350_SECS); @@ -666,6 +668,14 @@ static int gsm48_rx_gmm_id_resp(struct sgsn_mm_ctx *ctx, struct msgb *msg) LOGMMCTXP(LOGL_DEBUG, ctx, "-> GMM IDENTITY RESPONSE: mi_type=0x%02x MI(%s)\n", mi_type, mi_string); + if (ctx->t3370_id_type == GSM_MI_TYPE_NONE) { + LOGMMCTXP(LOGL_NOTICE, ctx, + "Got unexpected IDENTITY RESPONSE: mi_type=0x%02x MI(%s), " + "ignoring message\n", + mi_type, mi_string); + return -EINVAL; + } + if (mi_type == ctx->t3370_id_type) mmctx_timer_stop(ctx, 3370); -- cgit v1.2.3