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/.
Vadim Yanitskiy gerrit-no-reply at lists.osmocom.orgVadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/12022
Change subject: SS/USSD: fix: properly (re)schedule SS session timeout
......................................................................
SS/USSD: fix: properly (re)schedule SS session timeout
It may happen that either the MS or an ESME would become
unresponsive, e.g. due to a bug, or a dropped message. This
is why we have SS session timeout, that prevents keeping
'stalled' sessions forever.
For some reason, it wasn't properly resceduled in case of any
SS/USSD activity, so the lifetime of a session was limited to
hard-coded 30 seconds.
Let's introduce a VTY option, which can be used to configure
the timer (by default it is 120 seconds now):
hlr
...
! Use 0 to disable this timer
ss-guard-timeout 120
and properly (re)schedule it.
Change-Id: I00561c7aa692b19f85692e11f83ffc1826023120
Related: OS#3717
---
M src/hlr.c
M src/hlr.h
M src/hlr_ussd.c
M src/hlr_vty.c
M tests/test_nodes.vty
5 files changed, 36 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/22/12022/1
diff --git a/src/hlr.c b/src/hlr.c
index 78d6c91..9f1b907 100644
--- a/src/hlr.c
+++ b/src/hlr.c
@@ -604,6 +604,9 @@
INIT_LLIST_HEAD(&g_hlr->ss_sessions);
INIT_LLIST_HEAD(&g_hlr->ussd_routes);
+ /* Default SS guard timeout is 120 (i.e. 2 mins) */
+ g_hlr->ss_guard_timeout = 120;
+
rc = osmo_init_logging2(hlr_ctx, &hlr_log_info);
if (rc < 0) {
fprintf(stderr, "Error initializing logging\n");
diff --git a/src/hlr.h b/src/hlr.h
index 315c3dd..5236356 100644
--- a/src/hlr.h
+++ b/src/hlr.h
@@ -45,6 +45,9 @@
struct hlr_euse *euse_default;
struct llist_head iuse_list;
+ /* SS session guard timer value */
+ int ss_guard_timeout;
+
struct llist_head ussd_routes;
struct llist_head ss_sessions;
diff --git a/src/hlr_ussd.c b/src/hlr_ussd.c
index ba373f3..6ba1dcc 100644
--- a/src/hlr_ussd.c
+++ b/src/hlr_ussd.c
@@ -1,6 +1,7 @@
/* OsmoHLR SS/USSD implementation */
/* (C) 2018 Harald Welte <laforge at gnumonks.org>
+ * (C) 2018 by Vadim Yanitskiy <axilirator at gmail.com>
*
* All Rights Reserved
*
@@ -208,11 +209,13 @@
OSMO_STRLCPY_ARRAY(ss->imsi, imsi);
ss->session_id = session_id;
+
+ /* Schedule self-destruction timer */
osmo_timer_setup(&ss->timeout, ss_session_timeout, ss);
- /* NOTE: The timeout is currently global and not refreshed with subsequent messages
- * within the SS/USSD session. So 30s after the initial SS message, the session will
- * timeout! */
- osmo_timer_schedule(&ss->timeout, 30, 0);
+ if (g_hlr->ss_guard_timeout > 0) {
+ osmo_timer_schedule(&ss->timeout,
+ g_hlr->ss_guard_timeout, 0);
+ }
llist_add_tail(&ss->list, &hlr->ss_sessions);
return ss;
@@ -535,6 +538,13 @@
gsup->imsi, gsup->session_id);
goto out_err;
}
+
+ /* Reschedule self-destruction timer */
+ if (g_hlr->ss_guard_timeout > 0) {
+ osmo_timer_schedule(&ss->timeout,
+ g_hlr->ss_guard_timeout, 0);
+ }
+
if (ss_op_is_ussd(req.opcode)) {
/* dispatch unstructured SS to routing */
handle_ussd(conn, ss, gsup, &req);
diff --git a/src/hlr_vty.c b/src/hlr_vty.c
index 2d9b929..be49113 100644
--- a/src/hlr_vty.c
+++ b/src/hlr_vty.c
@@ -288,9 +288,22 @@
if (g_hlr->euse_default)
vty_out(vty, " ussd default-route external %s%s", g_hlr->euse_default->name, VTY_NEWLINE);
+ if (g_hlr->ss_guard_timeout > 0)
+ vty_out(vty, " ss-guard-timeout %i%s",
+ g_hlr->ss_guard_timeout, VTY_NEWLINE);
+
return 0;
}
+DEFUN(cfg_ss_guard_timeout, cfg_ss_guard_timeout_cmd,
+ "ss-guard-timeout <0-255>",
+ "Set guard timer for SS/USSD session activity\n"
+ "Guard timer value (sec.), or 0 to disable")
+{
+ g_hlr->ss_guard_timeout = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
/***********************************************************************
* Common Code
***********************************************************************/
@@ -353,6 +366,7 @@
install_element(HLR_NODE, &cfg_ussd_no_route_pfx_cmd);
install_element(HLR_NODE, &cfg_ussd_defaultroute_cmd);
install_element(HLR_NODE, &cfg_ussd_no_defaultroute_cmd);
+ install_element(HLR_NODE, &cfg_ss_guard_timeout_cmd);
hlr_vty_subscriber_init();
}
diff --git a/tests/test_nodes.vty b/tests/test_nodes.vty
index a9d4ac4..88ee5fb 100644
--- a/tests/test_nodes.vty
+++ b/tests/test_nodes.vty
@@ -77,6 +77,7 @@
no ussd route prefix PREFIX
ussd default-route external EUSE
no ussd default-route
+ ss-guard-timeout <0-255>
OsmoHLR(config-hlr)# gsup
OsmoHLR(config-hlr-gsup)# list
@@ -118,4 +119,5 @@
bind ip 127.0.0.1
ussd route prefix *#100# internal own-msisdn
ussd route prefix *#101# internal own-imsi
+ ss-guard-timeout 120
end
--
To view, visit https://gerrit.osmocom.org/12022
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I00561c7aa692b19f85692e11f83ffc1826023120
Gerrit-Change-Number: 12022
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181130/96026914/attachment.htm>