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
diff --git a/src/gprs/gprs_sgsn.c b/src/gprs/gprs_sgsn.c
index 768d953..c4321f9 100644
--- a/src/gprs/gprs_sgsn.c
+++ b/src/gprs/gprs_sgsn.c
@@ -255,21 +255,23 @@
{
#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;
}