aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-05-04 12:39:38 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-05-04 13:23:34 +0200
commitf3bcdd272b557c164950162ce5372c85cb8a731b (patch)
treef42d2851671368790fd4ef1ab78535463fdd5717
parent1d125c902fa163904dfa5364b82552cbabf6f7dd (diff)
msc subscr: add paging timeout
In NITB, the paging timeout would be handled from the BSC side. In IuCS, we need to invalidate the paging request from libmsc alone, so add a paging timer to gsm_subscriber. Possibly, the HNB-GW should respond with a paging failure and libmsc could trigger on that, nevertheless libmsc should not rely on a failure message to expire pending pagings.
-rw-r--r--openbsc/include/openbsc/gsm_subscriber.h1
-rw-r--r--openbsc/src/libmsc/gsm_subscriber.c28
2 files changed, 29 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/gsm_subscriber.h b/openbsc/include/openbsc/gsm_subscriber.h
index 86ecafd77..62d121365 100644
--- a/openbsc/include/openbsc/gsm_subscriber.h
+++ b/openbsc/include/openbsc/gsm_subscriber.h
@@ -71,6 +71,7 @@ struct gsm_subscriber {
/* pending requests */
int is_paging;
+ struct osmo_timer_list paging_timeout;
struct llist_head requests;
/* GPRS/SGSN related fields */
diff --git a/openbsc/src/libmsc/gsm_subscriber.c b/openbsc/src/libmsc/gsm_subscriber.c
index 950c5a00d..345dda869 100644
--- a/openbsc/src/libmsc/gsm_subscriber.c
+++ b/openbsc/src/libmsc/gsm_subscriber.c
@@ -110,6 +110,31 @@ static int subscr_paging_dispatch(unsigned int hooknum, unsigned int event,
return 0;
}
+static void paging_timeout_release(struct gsm_subscriber *subscr)
+{
+ DEBUGP(DPAG, "Paging timeout released for %s\n", subscr_name(subscr));
+ osmo_timer_del(&subscr->paging_timeout);
+}
+
+static void paging_timeout(void *data)
+{
+ struct gsm_subscriber *subscr = data;
+ DEBUGP(DPAG, "Paging timeout reached for %s\n", subscr_name(subscr));
+ paging_timeout_release(subscr);
+ subscr_paging_dispatch(GSM_HOOK_RR_PAGING, GSM_PAGING_EXPIRED,
+ NULL, NULL, subscr);
+}
+
+static void paging_timeout_start(struct gsm_subscriber *subscr)
+{
+ DEBUGP(DPAG, "Starting paging timeout for %s\n", subscr_name(subscr));
+ subscr->paging_timeout.data = subscr;
+ subscr->paging_timeout.cb = paging_timeout;
+ osmo_timer_schedule(&subscr->paging_timeout, 10, 0);
+ /* TODO: configurable timeout duration? */
+}
+
+
static int subscr_paging_sec_cb(unsigned int hooknum, unsigned int event,
struct msgb *msg, void *data, void *param)
{
@@ -154,6 +179,8 @@ int subscr_rx_paging_response(struct msgb *msg,
gh = msgb_l3(msg);
pr = (struct gsm48_pag_resp *)gh->data;
+ paging_timeout_release(conn->subscr);
+
/* Secure the connection */
if (subscr_authorized(conn->subscr))
return gsm48_secure_channel(conn, pr->key_seq,
@@ -199,6 +226,7 @@ struct subscr_request *subscr_request_conn(struct gsm_subscriber *subscr,
subscr->is_paging = 1;
LOGP(DMM, LOGL_DEBUG, "Paged subscriber %s.\n",
subscr_name(subscr));
+ paging_timeout_start(subscr);
}
else {
LOGP(DMM, LOGL_DEBUG, "Subscriber %s already paged.\n",