commit | 6463c0799c007e0454a348a533753171f1b525d8 | [log] [tgz] |
---|---|---|
author | Harald Welte <laforge@gnumonks.org> | Tue May 18 17:04:55 2010 +0200 |
committer | Harald Welte <laforge@gnumonks.org> | Tue May 18 17:04:55 2010 +0200 |
tree | 777ac703507ddfd5126955bd334130c4f91f0519 | |
parent | 4e38ac7a8aee4d63276d81a4269f6d9124dc1a77 [diff] [blame] |
[GPRS] SGSN: TMSI allocation
diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index 2671796..af8f896 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c
@@ -251,3 +251,18 @@ 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; +}