sgsn: Only look at TLLIs in sgsn_mm_ctx_by_tlli
Currently the code also matches the TLLI against LOCAL and FOREIGN mappings of the P-TMSI, thus eventually finding MM contexts not consistent with the TLLI (both tlli and tlli_new differ). On the other hand, tlli_new is not checked at all. This commit changes the function to only look at mmctx->tlli, mmctx->tlli_new, and the routing area. Sponsored-by: On-Waves ehf
This commit is contained in:
parent
e7bcdc3bda
commit
d58c033305
|
@ -90,47 +90,18 @@ static const struct rate_ctr_group_desc pdpctx_ctrg_desc = {
|
|||
.class_id = OSMO_STATS_CLASS_SUBSCRIBER,
|
||||
};
|
||||
|
||||
/* See 03.02 Chapter 2.6 */
|
||||
static inline uint32_t tlli_foreign(uint32_t tlli)
|
||||
{
|
||||
return ((tlli | 0x80000000) & ~0x40000000);
|
||||
}
|
||||
|
||||
/* look-up a SGSN MM context based on TLLI + RAI */
|
||||
struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli(uint32_t tlli,
|
||||
const struct gprs_ra_id *raid)
|
||||
{
|
||||
struct sgsn_mm_ctx *ctx;
|
||||
int tlli_type;
|
||||
|
||||
llist_for_each_entry(ctx, &sgsn_mm_ctxts, list) {
|
||||
if (tlli == ctx->tlli &&
|
||||
if ((tlli == ctx->tlli || tlli == ctx->tlli_new) &&
|
||||
gprs_ra_id_equals(raid, &ctx->ra))
|
||||
return ctx;
|
||||
}
|
||||
|
||||
tlli_type = gprs_tlli_type(tlli);
|
||||
switch (tlli_type) {
|
||||
case TLLI_LOCAL:
|
||||
llist_for_each_entry(ctx, &sgsn_mm_ctxts, list) {
|
||||
if ((ctx->p_tmsi | 0xC0000000) == tlli ||
|
||||
(ctx->p_tmsi_old && (ctx->p_tmsi_old | 0xC0000000) == tlli)) {
|
||||
ctx->tlli = tlli;
|
||||
return ctx;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TLLI_FOREIGN:
|
||||
llist_for_each_entry(ctx, &sgsn_mm_ctxts, list) {
|
||||
if (tlli == tlli_foreign(ctx->tlli) &&
|
||||
gprs_ra_id_equals(raid, &ctx->ra))
|
||||
return ctx;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1607,7 +1607,7 @@ static void test_gmm_cancel(void)
|
|||
*/
|
||||
static void test_gmm_ptmsi_allocation(void)
|
||||
{
|
||||
struct gprs_ra_id raid = { 0, };
|
||||
struct gprs_ra_id raid = {332, 112, 16464, 96};
|
||||
struct sgsn_mm_ctx *ctx = NULL;
|
||||
struct sgsn_mm_ctx *ictx;
|
||||
uint32_t foreign_tlli;
|
||||
|
|
Loading…
Reference in New Issue