From 794693c09360382a222a00b031cf5159a8088303 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 20 Dec 2017 11:38:01 +0100 Subject: Use connection id when allocating rate counters Due to recent libosmocore's change we can't allocate rate counters with the same name and index which are already allocated. This causes sgsn_mm_ctx_alloc_iu() failure for multiple subscribers. Fix this by using conn_id parameter from ranap_ue_conn_ctx. Change-Id: I1062ffdcac96c82269cab6f4e7ae50e28dc3aa44 Related: OS#2757 --- src/gprs/gprs_sgsn.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gprs/gprs_sgsn.c b/src/gprs/gprs_sgsn.c index 768d95350..c4321f91c 100644 --- a/src/gprs/gprs_sgsn.c +++ b/src/gprs/gprs_sgsn.c @@ -255,21 +255,23 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_alloc_iu(void *uectx) { #if BUILD_IU struct sgsn_mm_ctx *ctx; + struct ranap_ue_conn_ctx *ue_ctx = uectx; ctx = talloc_zero(tall_bsc_ctx, struct sgsn_mm_ctx); if (!ctx) return NULL; ctx->ran_type = MM_CTX_T_UTRAN_Iu; - ctx->iu.ue_ctx = uectx; + ctx->iu.ue_ctx = ue_ctx; ctx->iu.ue_ctx->rab_assign_addr_enc = sgsn->cfg.iu.rab_assign_addr_enc; ctx->iu.new_key = 1; ctx->gmm_state = GMM_DEREGISTERED; ctx->pmm_state = PMM_DETACHED; ctx->auth_triplet.key_seq = GSM_KEY_SEQ_INVAL; - ctx->ctrg = rate_ctr_group_alloc(ctx, &mmctx_ctrg_desc, 0); + ctx->ctrg = rate_ctr_group_alloc(ctx, &mmctx_ctrg_desc, ue_ctx->conn_id); if (!ctx->ctrg) { - LOGMMCTXP(LOGL_ERROR, ctx, "Cannot allocate counter group\n"); + LOGMMCTXP(LOGL_ERROR, ctx, "Cannot allocate counter group for %s.%u\n", + mmctx_ctrg_desc.group_name_prefix, ue_ctx->conn_id); talloc_free(ctx); return NULL; } -- cgit v1.2.3