[MERGED] osmo-msc[master]: fix: properly cancel all Paging on IMSI Detach

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Dec 21 11:50:13 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: fix: properly cancel all Paging on IMSI Detach
......................................................................


fix: properly cancel all Paging on IMSI Detach

It's not clear cut which code is responsible for canceling pending requests,
since the requests list is kept in vlr_subscr, but sending out Paging does
certainly not belong in the VLR. Place the requests cleanup in gsm_04_08.c.

Add to test_ms_timeout_paging() in msc_vlr_test_ms_timeout.c to verify that a
pending paging is canceled on IMSI Detach.

Change-Id: Ib8874a9d92f02b0826525b55518332f6899688fd
---
M include/osmocom/msc/gsm_subscriber.h
M src/libmsc/gsm_04_08.c
M src/libmsc/gsm_subscriber.c
M tests/msc_vlr/msc_vlr_test_ms_timeout.c
M tests/msc_vlr/msc_vlr_test_ms_timeout.err
5 files changed, 43 insertions(+), 5 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/msc/gsm_subscriber.h b/include/osmocom/msc/gsm_subscriber.h
index 6b0e3da..4adfd41 100644
--- a/include/osmocom/msc/gsm_subscriber.h
+++ b/include/osmocom/msc/gsm_subscriber.h
@@ -62,6 +62,7 @@
 int subscr_rx_paging_response(struct msgb *msg,
 			      struct gsm_subscriber_connection *conn);
 
+void subscr_paging_cancel(struct vlr_subscr *vsub, enum gsm_paging_event event);
 int subscr_paging_dispatch(unsigned int hooknum, unsigned int event,
 			   struct msgb *msg, void *data, void *param);
 
diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c
index e370962..26ac923 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -770,6 +770,10 @@
 		     gsm48_mi_type_name(mi_type), mi_string);
 	} else {
 		LOGP(DMM, LOGL_INFO, "IMSI DETACH for %s\n", vlr_subscr_name(vsub));
+
+		if (vsub->cs.is_paging)
+			subscr_paging_cancel(vsub, GSM_PAGING_EXPIRED);
+
 		vlr_subscr_rx_imsi_detach(vsub);
 		osmo_signal_dispatch(SS_SUBSCR, S_SUBSCR_DETACHED, vsub);
 		vlr_subscr_put(vsub);
diff --git a/src/libmsc/gsm_subscriber.c b/src/libmsc/gsm_subscriber.c
index b3d38d1..1a7bf59 100644
--- a/src/libmsc/gsm_subscriber.c
+++ b/src/libmsc/gsm_subscriber.c
@@ -52,6 +52,11 @@
 #include <osmocom/msc/msc_ifaces.h>
 #include <osmocom/msc/a_iface.h>
 
+void subscr_paging_cancel(struct vlr_subscr *vsub, enum gsm_paging_event event)
+{
+	subscr_paging_dispatch(GSM_HOOK_RR_PAGING, event, NULL, NULL, vsub);
+}
+
 int subscr_paging_dispatch(unsigned int hooknum, unsigned int event,
 			   struct msgb *msg, void *data, void *param)
 {
@@ -132,7 +137,7 @@
 static void paging_response_timer_cb(void *data)
 {
 	struct vlr_subscr *vsub = data;
-	subscr_paging_dispatch(GSM_HOOK_RR_PAGING, GSM_PAGING_EXPIRED, NULL, NULL, vsub);
+	subscr_paging_cancel(vsub, GSM_PAGING_EXPIRED);
 }
 
 /*! \brief Start a paging request for vsub, call cbfn(param) when done.
diff --git a/tests/msc_vlr/msc_vlr_test_ms_timeout.c b/tests/msc_vlr/msc_vlr_test_ms_timeout.c
index 4e0e27d..4cfd035 100644
--- a/tests/msc_vlr/msc_vlr_test_ms_timeout.c
+++ b/tests/msc_vlr/msc_vlr_test_ms_timeout.c
@@ -258,13 +258,26 @@
 	OSMO_ASSERT(vsub);
 	VERBOSE_ASSERT(vsub->cs.is_paging, == false, "%d");
 	VERBOSE_ASSERT(llist_count(&vsub->cs.requests), == 0, "%d");
+
+	BTW("Now that the timeout has expired, another Paging is sent on request");
+	paging_expect_imsi(imsi);
+	paging_sent = false;
+
+	send_sms(vsub, vsub,
+		 "Privacy in residential applications is a desirable"
+		 " marketing option.");
+
+	VERBOSE_ASSERT(llist_count(&vsub->cs.requests), == 1, "%d");
 	vlr_subscr_put(vsub);
 	vsub = NULL;
+	VERBOSE_ASSERT(paging_sent, == true, "%d");
+	VERBOSE_ASSERT(paging_stopped, == false, "%d");
 
-	BTW("subscriber detaches");
+	BTW("subscriber detaches, pagings are canceled");
 	expect_bssap_clear();
 	ms_sends_msg("050130089910070000006402");
 	VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
+	VERBOSE_ASSERT(paging_stopped, == true, "%d");
 
 	vsub = vlr_subscr_find_by_imsi(net->vlr, imsi);
 	OSMO_ASSERT(!vsub);
diff --git a/tests/msc_vlr/msc_vlr_test_ms_timeout.err b/tests/msc_vlr/msc_vlr_test_ms_timeout.err
index c8b7e96..f0c4116 100644
--- a/tests/msc_vlr/msc_vlr_test_ms_timeout.err
+++ b/tests/msc_vlr/msc_vlr_test_ms_timeout.err
@@ -480,16 +480,30 @@
 DREF VLR subscr MSISDN:46071 usage increases to: 2
   vsub->cs.is_paging == 0
   llist_count(&vsub->cs.requests) == 0
-DREF VLR subscr MSISDN:46071 usage decreases to: 1
 ---
-- subscriber detaches
+- Now that the timeout has expired, another Paging is sent on request
+DREF VLR subscr MSISDN:46071 usage increases to: 3
+DMM Subscriber MSISDN:46071 not paged yet, start paging.
+  RAN_GERAN_A sends out paging request to IMSI 901700000004620, TMSI 0xffffffff, LAC 23
+  strcmp(paging_expecting_imsi, imsi) == 0
+DREF VLR subscr MSISDN:46071 usage increases to: 4
+  llist_count(&vsub->cs.requests) == 1
+DREF VLR subscr MSISDN:46071 usage decreases to: 3
+  paging_sent == 1
+  paging_stopped == 0
+---
+- subscriber detaches, pagings are canceled
   MSC <--RAN_GERAN_A-- MS: GSM48_MT_MM_IMSI_DETACH_IND
   new conn
 DREF unknown: MSC conn use + compl_l3 == 1 (0x1)
 DRLL Dispatching 04.08 message GSM48_MT_MM_IMSI_DETACH_IND (0x5:0x1)
 DMM IMSI DETACH INDICATION: MI(IMSI)=901700000004620
-DREF VLR subscr MSISDN:46071 usage increases to: 2
+DREF VLR subscr MSISDN:46071 usage increases to: 4
 DMM IMSI DETACH for MSISDN:46071
+DPAG Paging failure for MSISDN:46071 (event=1)
+DPAG Calling paging cbfn.
+DREF VLR subscr MSISDN:46071 usage decreases to: 3
+DREF VLR subscr MSISDN:46071 usage decreases to: 2
 DREF VLR subscr MSISDN:46071 usage decreases to: 1
 DREF VLR subscr MSISDN:46071 usage decreases to: 0
 DREF freeing VLR subscr MSISDN:46071
@@ -498,6 +512,7 @@
 DREF unknown: MSC conn use - compl_l3 == 0 (0x0)
 DRLL Freeing subscriber connection with NULL subscriber
   bssap_clear_sent == 1
+  paging_stopped == 1
   llist_count(&net->subscr_conns) == 0
 ===== test_ms_timeout_paging: SUCCESS
 

-- 
To view, visit https://gerrit.osmocom.org/5464
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib8874a9d92f02b0826525b55518332f6899688fd
Gerrit-PatchSet: 4
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list