aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2020-01-25 10:49:14 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2020-01-25 10:52:26 +0700
commitbaf71a72ecbdb6b69bedced43853cf6c032ed492 (patch)
tree43a4a32a4fbcad4f7756777bf96a56fa7bbd835a
parentffc7f39f016091e19eedb18528228927e198a9c1 (diff)
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
-rw-r--r--doc/manuals/vty/msc_vty_reference.xml9
-rw-r--r--include/osmocom/msc/msc_common.h1
-rw-r--r--include/osmocom/msc/vlr.h8
-rw-r--r--src/libmsc/msc_net_init.c1
-rw-r--r--src/libvlr/vlr.c29
-rw-r--r--tests/test_nodes.vty2
6 files changed, 22 insertions, 28 deletions
diff --git a/doc/manuals/vty/msc_vty_reference.xml b/doc/manuals/vty/msc_vty_reference.xml
index 36cbf77a9..6418425f6 100644
--- a/doc/manuals/vty/msc_vty_reference.xml
+++ b/doc/manuals/vty/msc_vty_reference.xml
@@ -576,10 +576,11 @@
<param name='&lt;0-65535&gt;' doc='CI' />
</params>
</command>
- <command id='show timer [(mgw|mncc|sccp|geran|utran|sgs)] [TNNNN]'>
+ <command id='show timer [(vlr|mgw|mncc|sccp|geran|utran|sgs)] [TNNNN]'>
<params>
<param name='show' doc='Show running system information' />
<param name='timer' doc='Show timers' />
+ <param name='[vlr]' doc='VLR (Visitors Location Register)' />
<param name='[mgw]' doc='MGW (Media Gateway) interface' />
<param name='[mncc]' doc='MNCC (Mobile Network Call Control) interface' />
<param name='[sccp]' doc='SCCP (Signalling Connection Control Part)' />
@@ -1405,10 +1406,11 @@
<param name='&lt;0-65535&gt;' doc='CI' />
</params>
</command>
- <command id='show timer [(mgw|mncc|sccp|geran|utran|sgs)] [TNNNN]'>
+ <command id='show timer [(vlr|mgw|mncc|sccp|geran|utran|sgs)] [TNNNN]'>
<params>
<param name='show' doc='Show running system information' />
<param name='timer' doc='Show timers' />
+ <param name='[vlr]' doc='VLR (Visitors Location Register)' />
<param name='[mgw]' doc='MGW (Media Gateway) interface' />
<param name='[mncc]' doc='MNCC (Mobile Network Call Control) interface' />
<param name='[sccp]' doc='SCCP (Signalling Connection Control Part)' />
@@ -2936,9 +2938,10 @@
<param name='RAN_PC_OR_MSC_IPA_NAME' doc='Point code or MSC IPA name value' />
</params>
</command>
- <command id='timer [(mgw|mncc|sccp|geran|utran|sgs)] [TNNNN] [(&lt;0-2147483647&gt;|default)]'>
+ <command id='timer [(vlr|mgw|mncc|sccp|geran|utran|sgs)] [TNNNN] [(&lt;0-2147483647&gt;|default)]'>
<params>
<param name='timer' doc='Configure or show timers' />
+ <param name='[vlr]' doc='VLR (Visitors Location Register)' />
<param name='[mgw]' doc='MGW (Media Gateway) interface' />
<param name='[mncc]' doc='MNCC (Mobile Network Call Control) interface' />
<param name='[sccp]' doc='SCCP (Signalling Connection Control Part)' />
diff --git a/include/osmocom/msc/msc_common.h b/include/osmocom/msc/msc_common.h
index bd85722cd..8a43e69a3 100644
--- a/include/osmocom/msc/msc_common.h
+++ b/include/osmocom/msc/msc_common.h
@@ -10,6 +10,7 @@ struct gsm_network;
struct vlr_subscr;
extern struct osmo_tdef_group msc_tdef_group[];
+extern struct osmo_tdef msc_tdefs_vlr[];
#define MSC_HLR_REMOTE_IP_DEFAULT "127.0.0.1"
#define MSC_HLR_REMOTE_PORT_DEFAULT OSMO_GSUP_PORT
diff --git a/include/osmocom/msc/vlr.h b/include/osmocom/msc/vlr.h
index d22e3ec41..615c6c874 100644
--- a/include/osmocom/msc/vlr.h
+++ b/include/osmocom/msc/vlr.h
@@ -252,13 +252,6 @@ struct vlr_ops {
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,6 @@ struct vlr_instance {
bool auth_reuse_old_sets_on_error;
bool parq_retrieve_imsi;
bool is_ps;
- uint32_t timer[_NUM_VLR_TIMERS];
} cfg;
/* A free-form pointer for use by the caller */
void *user_ctx;
diff --git a/src/libmsc/msc_net_init.c b/src/libmsc/msc_net_init.c
index ffb8a3ba4..8c8fb861a 100644
--- a/src/libmsc/msc_net_init.c
+++ b/src/libmsc/msc_net_init.c
@@ -41,6 +41,7 @@ struct osmo_tdef mncc_tdefs[] = {
};
struct osmo_tdef_group msc_tdef_group[] = {
+ { .name = "vlr", .tdefs = msc_tdefs_vlr, .desc = "VLR (Visitors Location Register)" },
{ .name = "mgw", .tdefs = g_mgw_tdefs, .desc = "MGW (Media Gateway) interface" },
{ .name = "mncc", .tdefs = mncc_tdefs, .desc = "MNCC (Mobile Network Call Control) interface" },
{ .name = "sccp", .tdefs = g_sccp_tdefs, .desc = "SCCP (Signalling Connection Control Part)" },
diff --git a/src/libvlr/vlr.c b/src/libvlr/vlr.c
index b164fd8f2..a1489f219 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 @@ const struct value_string vlr_ciph_names[] = {
{ 0, NULL }
};
+/* 3GPP TS 24.008, table 11.2 Mobility management timers (network-side) */
+struct osmo_tdef msc_tdefs_vlr[] = {
+ /* 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(msc_tdefs_vlr, timer, OSMO_TDEF_S, 0);
}
/* return static buffer with printable name of VLR subscriber */
diff --git a/tests/test_nodes.vty b/tests/test_nodes.vty
index 2c2ce1b84..b87a3719d 100644
--- a/tests/test_nodes.vty
+++ b/tests/test_nodes.vty
@@ -69,7 +69,7 @@ OsmoMSC(config-msc)# list
neighbor (a|iu) lac-ci <0-65535> <0-65535> (ran-pc|msc-ipa-name) RAN_PC_OR_MSC_IPA_NAME
neighbor (a|iu) cgi <0-999> <0-999> <0-65535> <0-65535> (ran-pc|msc-ipa-name) RAN_PC_OR_MSC_IPA_NAME
no neighbor (a|iu) (ran-pc|msc-ipa-name) RAN_PC_OR_MSC_IPA_NAME
- timer [(mgw|mncc|sccp|geran|utran|sgs)] [TNNNN] [(<0-2147483647>|default)]
+ timer [(vlr|mgw|mncc|sccp|geran|utran|sgs)] [TNNNN] [(<0-2147483647>|default)]
mgw local-ip A.B.C.D
mgw local-port <0-65535>
mgw remote-ip A.B.C.D