summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-01-08 15:18:39 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-01-18 18:37:36 +0100
commit743dec4c0c80383556efac60f03d307287ecf024 (patch)
tree204c24f1dc965cdc1dd780b9363ffa2eb27a2534
parent65fa3f73a1151e896e4c74196680b7886a3b6be6 (diff)
gprs: Retry PURGE_MS procedure after timeout
Currently, when the PURGE_MS_REQ to the HLR gets lost (e.g. by a connection or peer failure), the expired subscriber entry will not get deleted. This commit adds a retry mechanism then restarts the procedure after a timeout (currently 10s). The maximum number of retries is limited (currently to 3 PURGE_MS messages). If none of these procedures is completed (either with success or error), the subscriber data is deleted. Sponsored-by: On-Waves ehf
-rw-r--r--openbsc/include/openbsc/gprs_sgsn.h1
-rw-r--r--openbsc/src/gprs/gprs_subscriber.c14
2 files changed, 14 insertions, 1 deletions
diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h
index 2ed46ffbe..2b94096f6 100644
--- a/openbsc/include/openbsc/gprs_sgsn.h
+++ b/openbsc/include/openbsc/gprs_sgsn.h
@@ -277,6 +277,7 @@ struct sgsn_subscriber_data {
int auth_triplets_updated;
int error_cause;
struct osmo_timer_list timer;
+ int retries;
};
#define LOGGSUBSCRP(level, subscr, fmt, args...) \
diff --git a/openbsc/src/gprs/gprs_subscriber.c b/openbsc/src/gprs/gprs_subscriber.c
index 58203bab8..8399ea137 100644
--- a/openbsc/src/gprs/gprs_subscriber.c
+++ b/openbsc/src/gprs/gprs_subscriber.c
@@ -32,6 +32,9 @@
#include <netinet/in.h>
#include <arpa/inet.h>
+#define SGSN_SUBSCR_MAX_RETRIES 3
+#define SGSN_SUBSCR_RETRY_INTERVAL 10
+
extern void *tall_bsc_ctx;
static int gsup_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg);
@@ -92,6 +95,7 @@ void gprs_subscr_start_timer(struct gsm_subscriber *subscr, unsigned seconds)
if (!subscr->sgsn_data->timer.data) {
subscr->sgsn_data->timer.cb = sgsn_subscriber_timeout_cb;
subscr->sgsn_data->timer.data = subscr_get(subscr);
+ subscr->sgsn_data->retries = 0;
}
osmo_timer_schedule(&subscr->sgsn_data->timer, seconds, 0);
@@ -107,7 +111,8 @@ static void sgsn_subscriber_timeout_cb(void *subscr_)
subscr_get(subscr);
/* Check, whether to cleanup immediately */
- if (!(subscr->flags & GPRS_SUBSCRIBER_ENABLE_PURGE))
+ if (!(subscr->flags & GPRS_SUBSCRIBER_ENABLE_PURGE) ||
+ subscr->sgsn_data->retries >= SGSN_SUBSCR_MAX_RETRIES)
goto force_cleanup;
/* Send a 'purge MS' message to the HLR */
@@ -116,6 +121,13 @@ static void sgsn_subscriber_timeout_cb(void *subscr_)
/* Purge request has been sent */
+ /* Check, whether purge is still enabled */
+ if (!(subscr->flags & GPRS_SUBSCRIBER_ENABLE_PURGE))
+ goto force_cleanup;
+
+ /* Make sure this will be tried again if there is no response in time */
+ subscr->sgsn_data->retries += 1;
+ gprs_subscr_start_timer(subscr, SGSN_SUBSCR_RETRY_INTERVAL);
subscr_put(subscr);
return;