From 07309078409181f491ea7625f871cab2700d93c8 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Thu, 17 Nov 2011 09:17:10 +0100 Subject: mobile/MM: Fixed handling of T3220 (IMSI detach timeout) If network will not terminate radio connection, the timeout will abort the radio connection. --- src/host/layer23/src/mobile/gsm48_mm.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'src/host') diff --git a/src/host/layer23/src/mobile/gsm48_mm.c b/src/host/layer23/src/mobile/gsm48_mm.c index 0208d466..ba06eafc 100644 --- a/src/host/layer23/src/mobile/gsm48_mm.c +++ b/src/host/layer23/src/mobile/gsm48_mm.c @@ -1841,7 +1841,6 @@ static int gsm48_mm_imsi_detach_end(struct osmocom_ms *ms, struct msgb *msg) /* stop IMSI detach timer (if running) */ stop_mm_t3220(mm); - /* SIM invalid */ subscr->sim_valid = 0; @@ -1868,6 +1867,24 @@ static int gsm48_mm_imsi_detach_end(struct osmocom_ms *ms, struct msgb *msg) return gsm48_mm_return_idle(ms, NULL); } +/* abort radio connection */ +static int gsm48_mm_imsi_detach_abort(struct osmocom_ms *ms, struct msgb *msg) +{ + struct msgb *nmsg; + struct gsm48_rr_hdr *nrrh; + + /* abort RR if timer fired */ + nmsg = gsm48_rr_msgb_alloc(GSM48_RR_ABORT_REQ); + if (!nmsg) + return -ENOMEM; + nrrh = (struct gsm48_rr_hdr *) nmsg->data; + nrrh->cause = GSM48_RR_CAUSE_NORMAL; + gsm48_rr_downmsg(ms, nmsg); + + /* imsi detach has ended now */ + return gsm48_mm_imsi_detach_end(ms, msg); +} + /* start an IMSI detach in MM IDLE */ static int gsm48_mm_imsi_detach_start(struct osmocom_ms *ms, struct msgb *msg) { @@ -4233,8 +4250,8 @@ static struct eventstate { {ALL_STATES, ALL_STATES, GSM48_MM_EVENT_IMSI_DETACH, gsm48_mm_imsi_detach_delay}, - {GSM48_MM_ST_IMSI_DETACH_INIT, ALL_STATES, - GSM48_MM_EVENT_TIMEOUT_T3220, gsm48_mm_imsi_detach_end}, + {SBIT(GSM48_MM_ST_IMSI_DETACH_INIT), ALL_STATES, + GSM48_MM_EVENT_TIMEOUT_T3220, gsm48_mm_imsi_detach_abort}, /* location update in other cases */ {SBIT(GSM48_MM_ST_MM_IDLE), ALL_STATES, -- cgit v1.2.3