path: root/openbsc/src/libmsc/gsm_subscriber.c
diff options
authorHolger Hans Peter Freyther <>2013-07-27 21:07:57 +0200
committerHolger Hans Peter Freyther <>2013-07-27 22:02:24 +0200
commitc63f6f1f324baaff41f8ea543f32479a09a71cd0 (patch)
tree58601ec5ddd1c3f8ec24d43b911b327d7a12df0e /openbsc/src/libmsc/gsm_subscriber.c
parente7bd863f763809b152fb21655abe7e8bba557561 (diff)
expiration: Allow to disable the periodic location updating procedure
Disable the periodic LU using "no periodic location update" VTY command. In that case set the expire_lu to 0 which will then be translated to a NULL in the database layer. This leads to a bit of copy and paste in the db_sync_subscriber method but I don't see how we could easily use 'datetime(%i, 'unixepoch')' and 'NULL' at the same time. Change the query to find expired queries to check for NOT NULL and the time being in the past. This means if there are still old subscribers in the database they might not be expired. One would need to execute a query like "UPATE Subscriber SET expire_lu = 0 WHERE expire_lu is null". The same applies when disabling the periodic LU. One would need to update the database by hand. Manual tests executed/passed: 1.) periodic LU enabled: * use gst to do a LU * UPDATE Subscriber SET expire_lu=datetime('now'); * observe the subscriber being expired (it was) 2.) periodic LU disabled: * use gst to do a LU * verify that the expire_lu is NULL in the database
Diffstat (limited to 'openbsc/src/libmsc/gsm_subscriber.c')
1 files changed, 7 insertions, 6 deletions
diff --git a/openbsc/src/libmsc/gsm_subscriber.c b/openbsc/src/libmsc/gsm_subscriber.c
index 6abb0d832..5ace8f666 100644
--- a/openbsc/src/libmsc/gsm_subscriber.c
+++ b/openbsc/src/libmsc/gsm_subscriber.c
@@ -333,8 +333,14 @@ int subscr_update_expire_lu(struct gsm_subscriber *s, struct gsm_bts *bts)
* periodic updating in decihours. Mark the subscriber as
* inactive if it missed two consecutive location updates.
* Timeout is twice the t3212 value plus one minute */
- s->expire_lu = time(NULL) +
+ /* Is expiration handling enabled? */
+ if (bts->si_common.chan_desc.t3212 == 0)
+ else
+ s->expire_lu = time(NULL) +
(bts->si_common.chan_desc.t3212 * 60 * 6 * 2) + 60;
rc = db_sync_subscriber(s);
return rc;
@@ -354,11 +360,6 @@ int subscr_update(struct gsm_subscriber *s, struct gsm_bts *bts, int reason)
LOGP(DMM, LOGL_INFO, "Subscriber %s ATTACHED LAC=%u\n",
subscr_name(s), s->lac);
- /* FIXME: We should allow 0 for T3212 as well to disable the
- * location update period. In that case we will need a way to
- * indicate that in the database and then reenable that value in
- * VTY.
- */
* The below will set a new expire_lu but as a side-effect
* the new lac will be saved in the database.