aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs/gprs_sgsn.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-05-18 17:04:55 +0200
committerHarald Welte <laforge@gnumonks.org>2010-05-18 17:04:55 +0200
commit6463c0799c007e0454a348a533753171f1b525d8 (patch)
tree777ac703507ddfd5126955bd334130c4f91f0519 /openbsc/src/gprs/gprs_sgsn.c
parent4e38ac7a8aee4d63276d81a4269f6d9124dc1a77 (diff)
[GPRS] SGSN: TMSI allocation
Diffstat (limited to 'openbsc/src/gprs/gprs_sgsn.c')
-rw-r--r--openbsc/src/gprs/gprs_sgsn.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c
index 2671796ab..af8f8965b 100644
--- a/openbsc/src/gprs/gprs_sgsn.c
+++ b/openbsc/src/gprs/gprs_sgsn.c
@@ -251,3 +251,18 @@ struct apn_ctx *apn_ctx_find_alloc(const char *name)
return actx;
}
#endif
+
+uint32_t sgsn_alloc_ptmsi(void)
+{
+ struct sgsn_mm_ctx *mm;
+ uint32_t ptmsi;
+
+restart:
+ ptmsi = rand();
+ llist_for_each_entry(mm, &sgsn_mm_ctxts, list) {
+ if (mm->p_tmsi == ptmsi)
+ goto restart;
+ }
+
+ return ptmsi;
+}