laforge has uploaded this change for review.

View Change

hnb_persistent: Use incrementing counter for rate_ctr + stat_item index

This will remove the annoying log messages like

DLGLOBAL ERROR counter group 'hnb' already exists for index 0, instead using index 1. This is a software bug that needs fixing. (rate_ctr.c:221)

Closes: OS#6433
Change-Id: I0bb6a679fb05a6aba917f089401fe3765a5d1fc3
---
M src/osmo-hnbgw/hnbgw.c
1 file changed, 19 insertions(+), 2 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/64/37664/1
diff --git a/src/osmo-hnbgw/hnbgw.c b/src/osmo-hnbgw/hnbgw.c
index d4515a8..90b8147 100644
--- a/src/osmo-hnbgw/hnbgw.c
+++ b/src/osmo-hnbgw/hnbgw.c
@@ -497,19 +497,22 @@
osmo_timer_schedule(&hnbp->disconnected_timeout, period_s, 0);
}

+static unsigned int g_hnbp_ctr_id;
+
struct hnb_persistent *hnb_persistent_alloc(const struct umts_cell_id *id)
{
struct hnb_persistent *hnbp = talloc_zero(g_hnbgw, struct hnb_persistent);
+ unsigned int ctr_id = g_hnbp_ctr_id++;
if (!hnbp)
return NULL;

hnbp->id = *id;
hnbp->id_str = talloc_strdup(hnbp, umts_cell_id_to_str(id));
- hnbp->ctrs = rate_ctr_group_alloc(hnbp, &hnb_ctrg_desc, 0);
+ hnbp->ctrs = rate_ctr_group_alloc(hnbp, &hnb_ctrg_desc, ctr_id);
if (!hnbp->ctrs)
goto out_free;
rate_ctr_group_set_name(hnbp->ctrs, hnbp->id_str);
- hnbp->statg = osmo_stat_item_group_alloc(hnbp, &hnb_statg_desc, 0);
+ hnbp->statg = osmo_stat_item_group_alloc(hnbp, &hnb_statg_desc, ctr_id);
if (!hnbp->statg)
goto out_free_ctrs;
osmo_stat_item_group_set_name(hnbp->statg, hnbp->id_str);

To view, visit change 37664. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I0bb6a679fb05a6aba917f089401fe3765a5d1fc3
Gerrit-Change-Number: 37664
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge@osmocom.org>
Gerrit-MessageType: newchange