From ae510dc4a743e981b40fc5e1fdb4c109f2425e27 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 3 Oct 2017 17:46:14 +0800 Subject: rate_ctr: Enforce counter (and ctr_group) names are valid identifiers As rate counters are automatically exposed on the CTRL interface, we need to make sure they don't contain special characters such as '.' which are not permitted/supported by CTRL. In order to be able to run old versions of osmocom programs with libosmocore versions after this commit, we introduce some special name mangling: Any '.' in the names are replaced with ':' during counter group registration, if valid identifiers can be obtained this way. Change-Id: Ifc6ac824f5dae9a848bb4a5d067c64a69eb40b56 --- tests/gb/gprs_ns_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/gb/gprs_ns_test.c') diff --git a/tests/gb/gprs_ns_test.c b/tests/gb/gprs_ns_test.c index 0bbf9432..fac3c36f 100644 --- a/tests/gb/gprs_ns_test.c +++ b/tests/gb/gprs_ns_test.c @@ -261,7 +261,7 @@ static void dump_rate_ctr_group(FILE *stream, const char *prefix, for (i = 0; i < ctrg->desc->num_ctr; i++) { struct rate_ctr *ctr = &ctrg->ctr[i]; - if (ctr->current && !strchr(ctrg->desc->ctr_desc[i].name, '.')) + if (ctr->current && !strchr(ctrg->desc->ctr_desc[i].name, ':')) fprintf(stream, " %s%s: %llu%s", prefix, ctrg->desc->ctr_desc[i].description, (long long)ctr->current, -- cgit v1.2.3