Change in osmo-msc[master]: libvlr: use generic osmo_tdef API for T3250, T3260, and T3270

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/.

fixeria gerrit-no-reply at lists.osmocom.org
Sat Jan 18 23:43:35 UTC 2020


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-msc/+/16933 )


Change subject: libvlr: use generic osmo_tdef API for T3250, T3260, and T3270
......................................................................

libvlr: use generic osmo_tdef API for T3250, T3260, and T3270

These timers so far were implemented as a list of unsigned integers,
which has never been initialized to any reasonable defaults. Since
they are used as state timeouts in several FSMs, we might end up
staying in some state forever.

Let's migrate to generic osmo_tdef API and use default values from
table 11.2 of 3GPP TS 24.008. This way the user can introspect and
change their values from the VTY / configuration file.

Change-Id: Ia8cf98da0aea0e626c5ff088a833d7359c43847f
Related: OS#4368
---
M doc/manuals/vty/msc_vty_reference.xml
M include/osmocom/msc/vlr.h
M src/libmsc/msc_vty.c
M src/libvlr/vlr.c
M tests/test_nodes.vty
5 files changed, 38 insertions(+), 32 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/33/16933/1

diff --git a/doc/manuals/vty/msc_vty_reference.xml b/doc/manuals/vty/msc_vty_reference.xml
index e3294cf..aed52ee 100644
--- a/doc/manuals/vty/msc_vty_reference.xml
+++ b/doc/manuals/vty/msc_vty_reference.xml
@@ -610,10 +610,11 @@
         <param name='sgs-connections' doc='Show SGs interface connections / MMEs' />
       </params>
     </command>
-    <command id='show timer (mgw|mncc|sccp) [TNNNN]'>
+    <command id='show timer (vlr|mgw|mncc|sccp) [TNNNN]'>
       <params>
         <param name='show' doc='Show running system information' />
         <param name='timer' doc='Show timers' />
+        <param name='vlr' doc='VLR specific timers' />
         <param name='mgw' doc='MGW specific timers' />
         <param name='mncc' doc='MNCC specific timers' />
         <param name='sccp' doc='SCCP specific timers' />
@@ -1462,10 +1463,11 @@
         <param name='sgs-connections' doc='Show SGs interface connections / MMEs' />
       </params>
     </command>
-    <command id='show timer (mgw|mncc|sccp) [TNNNN]'>
+    <command id='show timer (vlr|mgw|mncc|sccp) [TNNNN]'>
       <params>
         <param name='show' doc='Show running system information' />
         <param name='timer' doc='Show timers' />
+        <param name='vlr' doc='VLR specific timers' />
         <param name='mgw' doc='MGW specific timers' />
         <param name='mncc' doc='MNCC specific timers' />
         <param name='sccp' doc='SCCP specific timers' />
@@ -2931,9 +2933,10 @@
         <param name='MSISDN_LAST' doc='Last Handover Number MSISDN' />
       </params>
     </command>
-    <command id='timer (mgw|mncc|sccp) [TNNNN] [(<0-2147483647>|default)]'>
+    <command id='timer (vlr|mgw|mncc|sccp) [TNNNN] [(<0-2147483647>|default)]'>
       <params>
         <param name='timer' doc='Configure or show timers' />
+        <param name='vlr' doc='VLR specific timers' />
         <param name='mgw' doc='MGW specific timers' />
         <param name='mncc' doc='MNCC specific timers' />
         <param name='sccp' doc='SCCP specific timers' />
diff --git a/include/osmocom/msc/vlr.h b/include/osmocom/msc/vlr.h
index d22e3ec..1508598 100644
--- a/include/osmocom/msc/vlr.h
+++ b/include/osmocom/msc/vlr.h
@@ -252,13 +252,6 @@
 	int (*subscr_assoc)(void *msc_conn_ref, struct vlr_subscr *vsub);
 };
 
-enum vlr_timer {
-	VLR_T_3250,
-	VLR_T_3260,
-	VLR_T_3270,
-	_NUM_VLR_TIMERS
-};
-
 /* An instance of the VLR codebase */
 struct vlr_instance {
 	struct llist_head subscribers;
@@ -275,7 +268,8 @@
 		bool auth_reuse_old_sets_on_error;
 		bool parq_retrieve_imsi;
 		bool is_ps;
-		uint32_t timer[_NUM_VLR_TIMERS];
+		/* see vlr_instance_tdefs */
+		struct osmo_tdef *tdefs;
 	} cfg;
 	/* A free-form pointer for use by the caller */
 	void *user_ctx;
diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c
index b43e950..f6dfaaa 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -656,8 +656,9 @@
 }
 
 DEFUN(cfg_msc_timer, cfg_msc_timer_cmd,
-      "timer (mgw|mncc|sccp) " OSMO_TDEF_VTY_ARG_SET_OPTIONAL,
+      "timer (vlr|mgw|mncc|sccp) " OSMO_TDEF_VTY_ARG_SET_OPTIONAL,
       "Configure or show timers\n"
+      "VLR specific timers\n"
       "MGW specific timers\n"
       "MNCC specific timers\n"
       "SCCP specific timers\n"
@@ -666,7 +667,9 @@
 	const char *T_arg = argc > 1 ? argv[1] : NULL;
 	struct osmo_tdef *tdefs = NULL;
 
-	if (!strcmp(argv[0], "mgw"))
+	if (!strcmp(argv[0], "vlr"))
+		tdefs = gsmnet->vlr->cfg.tdefs;
+	else if (!strcmp(argv[0], "mgw"))
 		tdefs = gsmnet->mgw.tdefs;
 	else if (!strcmp(argv[0], "mncc"))
 		tdefs = gsmnet->mncc_tdefs;
@@ -773,6 +776,7 @@
 	neighbor_ident_vty_write(vty);
 
 	/* Timer management commands */
+	osmo_tdef_vty_write(vty, gsmnet->vlr->cfg.tdefs, " timer vlr ");
 	osmo_tdef_vty_write(vty, gsmnet->mgw.tdefs, " timer mgw ");
 	osmo_tdef_vty_write(vty, gsmnet->mncc_tdefs, " timer mncc ");
 	osmo_tdef_vty_write(vty, g_sccp_tdefs, " timer sccp ");
@@ -786,8 +790,9 @@
 }
 
 DEFUN(show_timer, show_timer_cmd,
-      "show timer (mgw|mncc|sccp) " OSMO_TDEF_VTY_ARG_T_OPTIONAL,
+      "show timer (vlr|mgw|mncc|sccp) " OSMO_TDEF_VTY_ARG_T_OPTIONAL,
       SHOW_STR "Show timers\n"
+      "VLR specific timers\n"
       "MGW specific timers\n"
       "MNCC specific timers\n"
       "SCCP specific timers\n"
@@ -796,7 +801,9 @@
 	const char *T_arg = argc > 1 ? argv[1] : NULL;
 	struct osmo_tdef *tdefs = NULL;
 
-	if (!strcmp(argv[0], "mgw"))
+	if (!strcmp(argv[0], "vlr"))
+		tdefs = gsmnet->vlr->cfg.tdefs;
+	else if (!strcmp(argv[0], "mgw"))
 		tdefs = gsmnet->mgw.tdefs;
 	else if (!strcmp(argv[0], "mncc"))
 		tdefs = gsmnet->mncc_tdefs;
@@ -849,6 +856,7 @@
       SHOW_STR "Show timers\n"
       "Show all existing timers\n")
 {
+	TDEF_LIST_PRINT(gsmnet->vlr->cfg.tdefs, "VLR specific timers", 2);
 	TDEF_LIST_PRINT(gsmnet->mgw.tdefs, "MGW specific timers", 2);
 	TDEF_LIST_PRINT(gsmnet->mncc_tdefs, "MNCC specific timers", 2);
 	TDEF_LIST_PRINT(g_sccp_tdefs, "SCCP specific timers", 2);
diff --git a/src/libvlr/vlr.c b/src/libvlr/vlr.c
index b164fd8..0e7cfe8 100644
--- a/src/libvlr/vlr.c
+++ b/src/libvlr/vlr.c
@@ -23,6 +23,7 @@
 #include <osmocom/core/fsm.h>
 #include <osmocom/core/utils.h>
 #include <osmocom/core/timer.h>
+#include <osmocom/core/tdef.h>
 #include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
 #include <osmocom/gsm/gsup.h>
 #include <osmocom/gsm/apn.h>
@@ -61,24 +62,20 @@
 	{ 0, NULL }
 };
 
+/* 3GPP TS 24.008, table 11.2 Mobility management timers (network-side) */
+static struct osmo_tdef vlr_instance_tdefs[] = {
+	/* TODO: also define T3212 here */
+	{ .T = 3250, .default_val = 12, .desc = "TMSI Reallocation procedure" },
+	{ .T = 3260, .default_val = 12, .desc = "Authentication procedure" },
+	{ .T = 3270, .default_val = 12, .desc = "Identification procedure" },
+	{ /* terminator */ }
+};
+
+/* This is just a wrapper around the osmo_tdef API.
+ * TODO: we should start using osmo_tdef_fsm_inst_state_chg() */
 uint32_t vlr_timer(struct vlr_instance *vlr, uint32_t timer)
 {
-	uint32_t tidx = 0xffffffff;
-
-	switch (timer) {
-	case 3270:
-		tidx = VLR_T_3270;
-		break;
-	case 3260:
-		tidx = VLR_T_3260;
-		break;
-	case 3250:
-		tidx = VLR_T_3250;
-		break;
-	}
-
-	OSMO_ASSERT(tidx < sizeof(vlr->cfg.timer));
-	return vlr->cfg.timer[tidx];
+	return osmo_tdef_get(vlr->cfg.tdefs, timer, OSMO_TDEF_S, 0);
 }
 
 /* return static buffer with printable name of VLR subscriber */
@@ -1266,6 +1263,10 @@
 	/* defaults */
 	vlr->cfg.assign_tmsi = true;
 
+	/* Timers configuration */
+	vlr->cfg.tdefs = vlr_instance_tdefs;
+	osmo_tdefs_reset(vlr->cfg.tdefs);
+
 	/* osmo_auth_fsm.c */
 	OSMO_ASSERT(osmo_fsm_register(&vlr_auth_fsm) == 0);
 	/* osmo_lu_fsm.c */
diff --git a/tests/test_nodes.vty b/tests/test_nodes.vty
index da565f4..39755c3 100644
--- a/tests/test_nodes.vty
+++ b/tests/test_nodes.vty
@@ -65,7 +65,7 @@
   no sms-over-gsup
   osmux (on|off|only)
   handover-number range MSISDN_FIRST MSISDN_LAST
-  timer (mgw|mncc|sccp) [TNNNN] [(<0-2147483647>|default)]
+  timer (vlr|mgw|mncc|sccp) [TNNNN] [(<0-2147483647>|default)]
   timer ran (geran|utran|sgs) [TNNNN] [(<0-2147483647>|default)]
   neighbor (a|iu) lac <0-65535> (ran-pc|msc-ipa-name) RAN_PC_OR_MSC_IPA_NAME
   neighbor (a|iu) lac-ci <0-65535> <0-65535> (ran-pc|msc-ipa-name) RAN_PC_OR_MSC_IPA_NAME

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/16933
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Ia8cf98da0aea0e626c5ff088a833d7359c43847f
Gerrit-Change-Number: 16933
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200118/7012c0ba/attachment.htm>


More information about the gerrit-log mailing list