From 6463c0799c007e0454a348a533753171f1b525d8 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 18 May 2010 17:04:55 +0200 Subject: [GPRS] SGSN: TMSI allocation --- openbsc/src/gprs/gprs_sgsn.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'openbsc/src/gprs/gprs_sgsn.c') 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; +} -- cgit v1.2.3