From 173bdf303be5c9f657547b5992916227cd3c1a4d Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 15 May 2022 12:12:54 +0200 Subject: [PATCH] vlr: Split vlr_subscr_rx_imsi_detach() The function vlr_subscr_rx_imsi_detach() implies that an explicit IMSI DETACH was received. However, that same function was called in other situations such as timer expiration or GSUP CANCEL. Let's clean this up by splitting the function into two parts. No logical change is introduced to the VLR in this patch. Change-Id: Iffc02f3062ad591ca372a3c6d866066cf63a8830 --- src/libvlr/vlr.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/libvlr/vlr.c b/src/libvlr/vlr.c index fc23b370d..f98fee6ea 100644 --- a/src/libvlr/vlr.c +++ b/src/libvlr/vlr.c @@ -55,6 +55,8 @@ * Convenience functions ***********************************************************************/ +static int vlr_subscr_detach(struct vlr_subscr *vsub); + const struct value_string vlr_ciph_names[] = { OSMO_VALUE_STRING(VLR_CIPH_NONE), OSMO_VALUE_STRING(VLR_CIPH_A5_1), @@ -578,7 +580,7 @@ void vlr_subscr_expire_lu(void *data) continue; LOGP(DVLR, LOGL_DEBUG, "%s: Location Update expired\n", vlr_subscr_name(vsub)); - vlr_subscr_rx_imsi_detach(vsub); + vlr_subscr_detach(vsub); } done: @@ -1070,7 +1072,7 @@ static int vlr_subscr_handle_cancel_req(struct vlr_subscr *vsub, vlr_gmm_cause_to_mm_cause(gsup_msg->cause, &gsm48_rej); vlr_subscr_cancel_attach_fsm(vsub, fsm_cause, gsm48_rej); - vlr_subscr_rx_imsi_detach(vsub); + vlr_subscr_detach(vsub); return rc; } @@ -1236,8 +1238,7 @@ bool vlr_subscr_expire(struct vlr_subscr *vsub) return false; } -/* See TS 23.012 version 9.10.0 4.3.2.1 "Process Detach_IMSI_VLR" */ -int vlr_subscr_rx_imsi_detach(struct vlr_subscr *vsub) +static int vlr_subscr_detach(struct vlr_subscr *vsub) { /* paranoia: should any LU or PARQ FSMs still be running, stop them. */ vlr_subscr_cancel_attach_fsm(vsub, OSMO_FSM_TERM_ERROR, GSM48_REJECT_CONGESTION); @@ -1253,6 +1254,12 @@ int vlr_subscr_rx_imsi_detach(struct vlr_subscr *vsub) return 0; } +/* See TS 23.012 version 9.10.0 4.3.2.1 "Process Detach_IMSI_VLR" */ +int vlr_subscr_rx_imsi_detach(struct vlr_subscr *vsub) +{ + return vlr_subscr_detach(vsub); +} + /* Tear down any running FSMs due to MSC connection timeout. * Visit all vsub->*_fsm pointers and give them a queue to send a final reject * message before the entire connection is torn down.