commit | 64df8edaadb37105b8042ba2d1cdc42c7cfcea2c | [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 | 7d7fd2b7fc2e36a81a4206e4c440fcccfe6c42b6 [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; +}