[PATCH] libosmocore[master]: rate_ctr: Enforce counter (and ctr_group) names are valid id...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue Oct 3 10:41:42 UTC 2017


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/4130

to look at the new patch set (#2).

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
---
M include/osmocom/core/rate_ctr.h
M src/rate_ctr.c
M tests/gb/gprs_ns_test.ok
M tests/stats/stats_test.ok
4 files changed, 397 insertions(+), 44 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/30/4130/2

diff --git a/include/osmocom/core/rate_ctr.h b/include/osmocom/core/rate_ctr.h
index 74414e9..6ce2dfe 100644
--- a/include/osmocom/core/rate_ctr.h
+++ b/include/osmocom/core/rate_ctr.h
@@ -48,7 +48,7 @@
 	/*! The class to which this group belongs */
 	int class_id;
 	/*! The number of counters in this group */
-	const unsigned int num_ctr;
+	unsigned int num_ctr;
 	/*! Pointer to array of counter names */
 	const struct rate_ctr_desc *ctr_desc;
 };
diff --git a/src/rate_ctr.c b/src/rate_ctr.c
index 2985bbb..0519eaf 100644
--- a/src/rate_ctr.c
+++ b/src/rate_ctr.c
@@ -1,4 +1,4 @@
-/* (C) 2009-2010 by Harald Welte <laforge at gnumonks.org>
+/* (C) 2009-2017 by Harald Welte <laforge at gnumonks.org>
  *
  * All Rights Reserved
  *
@@ -24,6 +24,7 @@
  *
  * \file rate_ctr.c */
 
+#include <stdbool.h>
 #include <stdint.h>
 #include <string.h>
 
@@ -32,10 +33,116 @@
 #include <osmocom/core/talloc.h>
 #include <osmocom/core/timer.h>
 #include <osmocom/core/rate_ctr.h>
+#include <osmocom/core/logging.h>
 
 static LLIST_HEAD(rate_ctr_groups);
 
 static void *tall_rate_ctr_ctx;
+
+
+static bool rate_ctrl_group_desc_validate(const struct rate_ctr_group_desc *desc, bool quiet)
+{
+	unsigned int i;
+	const struct rate_ctr_desc *ctr_desc = desc->ctr_desc;
+
+	if (!desc) {
+		LOGP(DLGLOBAL, LOGL_ERROR, "NULL is not a valid counter group descriptor\n");
+		return false;
+	}
+
+	DEBUGP(DLGLOBAL, "validating counter group %p(%s) with %u counters\n", desc,
+		desc->group_name_prefix, desc->num_ctr);
+
+	if (!osmo_identifier_valid(desc->group_name_prefix)) {
+		if (!quiet)
+			LOGP(DLGLOBAL, LOGL_ERROR, "'%s' is not a valid counter group identifier\n",
+				desc->group_name_prefix);
+		return false;
+	}
+
+	for (i = 0; i < desc->num_ctr; i++) {
+		if (!osmo_identifier_valid(ctr_desc[i].name)) {
+			if (!quiet)
+				LOGP(DLGLOBAL, LOGL_ERROR, "'%s' is not a valid counter identifier\n",
+					ctr_desc[i].name);
+			return false;
+		}
+	}
+
+	return true;
+}
+
+/* return 'in' if it doesn't contaon any '.'; otherwise allocate a copy and
+ * replace all '.' with ':' */
+static char *mangle_identifier_ifneeded(const void *ctx, const char *in)
+{
+	char *out;
+	unsigned int i;
+
+	if (!in)
+		return NULL;
+
+	if (!strchr(in, '.'))
+		return (char *)in;
+
+	out = talloc_strdup(ctx, in);
+	OSMO_ASSERT(out);
+
+	for (i = 0; i < strlen(out); i++) {
+		if (out[i] == '.')
+			out[i] = ':';
+	}
+
+	return out;
+}
+
+/* "mangle" a rate counter group descriptor, i.e. replace any '.' with ':' */
+static struct rate_ctr_group_desc *
+rate_ctr_group_desc_mangle(void *ctx, const struct rate_ctr_group_desc *desc)
+{
+	struct rate_ctr_group_desc *desc_new = talloc_zero(ctx, struct rate_ctr_group_desc);
+	int i;
+
+	OSMO_ASSERT(desc_new);
+
+	/* mangle the name_prefix but copy/keep the rest */
+	desc_new->group_name_prefix = mangle_identifier_ifneeded(desc_new, desc->group_name_prefix);
+	desc_new->group_description = desc->group_description;
+	desc_new->class_id = desc->class_id;
+	desc_new->num_ctr = desc->num_ctr;
+	desc_new->ctr_desc = talloc_array(desc_new, struct rate_ctr_desc, desc_new->num_ctr);
+	OSMO_ASSERT(desc_new->ctr_desc);
+
+	for (i = 0; i < desc->num_ctr; i++) {
+		struct rate_ctr_desc *ctrd_new = (struct rate_ctr_desc *) desc_new->ctr_desc;
+		const struct rate_ctr_desc *ctrd = desc->ctr_desc;
+
+		if (!ctrd[i].name) {
+			LOGP(DLGLOBAL, LOGL_ERROR, "counter group '%s'[%d] == NULL, aborting\n",
+				desc->group_name_prefix, i);
+			goto err_free;
+		}
+
+		ctrd_new[i].name = mangle_identifier_ifneeded(desc_new->ctr_desc, ctrd[i].name);
+		ctrd_new[i].description = ctrd[i].description;
+	}
+
+	if (!rate_ctrl_group_desc_validate(desc_new, false)) {
+		/* simple mangling of identifiers ('.' -> ':') was not sufficient to render a valid
+		 * descriptor, we have to bail out */
+		LOGP(DLGLOBAL, LOGL_ERROR, "counter group '%s' still invalid after mangling\n",
+			desc->group_name_prefix);
+		goto err_free;
+	}
+
+	LOGP(DLGLOBAL, LOGL_INFO, "Needed to mangle ounter group '%s' names still using '.' as "
+		"separator, please consider updating the application\n", desc->group_name_prefix);
+
+	return desc_new;
+err_free:
+	talloc_free(desc_new);
+	return NULL;
+}
 
 /*! Allocate a new group of counters according to description
  *  \param[in] ctx \ref talloc context
@@ -49,6 +156,15 @@
 	unsigned int size;
 	struct rate_ctr_group *group;
 
+	/* attempt to mangle all '.' in identifiers to ':' for backwards compat */
+	if (!rate_ctrl_group_desc_validate(desc, true)) {
+		/* don't use 'ctx' here as it would screw up memory leak debugging e.g.
+		 * in osmo-msc */
+		desc = rate_ctr_group_desc_mangle(NULL, desc);
+		if (!desc)
+			return NULL;
+	}
+
 	size = sizeof(struct rate_ctr_group) +
 			desc->num_ctr * sizeof(struct rate_ctr);
 
diff --git a/tests/gb/gprs_ns_test.ok b/tests/gb/gprs_ns_test.ok
index b0c81e4..bd3cca8 100644
--- a/tests/gb/gprs_ns_test.ok
+++ b/tests/gb/gprs_ns_test.ok
@@ -15,6 +15,10 @@
 
 Current NS-VCIs:
     VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111, blocked
+         Packets at NS Level  ( In): 1
+         Packets at NS Level  (Out): 2
+         Bytes at NS Level    ( In): 12
+         Bytes at NS Level    (Out): 10
 
 --- Delete nsvc object (round 0)---
 
@@ -36,6 +40,10 @@
 
 Current NS-VCIs:
     VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111, blocked
+         Packets at NS Level  ( In): 1
+         Packets at NS Level  (Out): 2
+         Bytes at NS Level    ( In): 12
+         Bytes at NS Level    (Out): 10
 
 --- Delete nsvc object (round 1)---
 
@@ -57,6 +65,10 @@
 
 Current NS-VCIs:
     VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111, blocked
+         Packets at NS Level  ( In): 1
+         Packets at NS Level  (Out): 2
+         Bytes at NS Level    ( In): 12
+         Bytes at NS Level    (Out): 10
 
 --- Delete nsvc object (round 2)---
 
@@ -78,6 +90,10 @@
 
 Current NS-VCIs:
     VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111, blocked
+         Packets at NS Level  ( In): 1
+         Packets at NS Level  (Out): 2
+         Bytes at NS Level    ( In): 12
+         Bytes at NS Level    (Out): 10
 
 --- Delete nsvc object (round 3)---
 
@@ -146,6 +162,10 @@
 
 Current NS-VCIs:
     VCI 0x1122, NSEI 0x1122, peer 0x01020304:1111
+         Packets at NS Level  ( In): 4
+         Packets at NS Level  (Out): 4
+         Bytes at NS Level    ( In): 15
+         Bytes at NS Level    (Out): 12
 
 PROCESSING BSSGP RESET from 0x01020304:1111
 00 00 00 00 22 04 82 4a 2e 07 81 08 08 88 10 20 30 40 50 60 10 00 
@@ -171,6 +191,10 @@
 
 Current NS-VCIs:
     VCI 0x1122, NSEI 0x1122, peer 0x01020304:2222, blocked
+         Packets at NS Level  ( In): 6
+         Packets at NS Level  (Out): 6
+         Bytes at NS Level    ( In): 49
+         Bytes at NS Level    (Out): 22
 
 --- Peer port changes, RESET, VCI changes ---
 
@@ -188,7 +212,15 @@
 
 Current NS-VCIs:
     VCI 0x3344, NSEI 0x1122, peer 0x01020304:3333, blocked
+         Packets at NS Level  ( In): 1
+         Packets at NS Level  (Out): 2
+         Bytes at NS Level    ( In): 12
+         Bytes at NS Level    (Out): 10
     VCI 0x1122, NSEI 0x1122, peer 0x01020304:2222, blocked
+         Packets at NS Level  ( In): 6
+         Packets at NS Level  (Out): 6
+         Bytes at NS Level    ( In): 49
+         Bytes at NS Level    (Out): 22
 
 --- Peer port changes, RESET, NSEI changes ---
 
@@ -206,7 +238,15 @@
 
 Current NS-VCIs:
     VCI 0x3344, NSEI 0x1122, peer 0x01020304:3333, blocked
+         Packets at NS Level  ( In): 1
+         Packets at NS Level  (Out): 2
+         Bytes at NS Level    ( In): 12
+         Bytes at NS Level    (Out): 10
     VCI 0x1122, NSEI 0x3344, peer 0x01020304:4444, blocked
+         Packets at NS Level  ( In): 7
+         Packets at NS Level  (Out): 8
+         Bytes at NS Level    ( In): 61
+         Bytes at NS Level    (Out): 32
          NS-VC changed NSEI count  : 1
 
 --- Peer port 3333, RESET, VCI is changed back ---
@@ -226,7 +266,15 @@
 
 Current NS-VCIs:
     VCI 0x3344, NSEI 0x1122, peer 0x00000000:0, blocked
+         Packets at NS Level  ( In): 2
+         Packets at NS Level  (Out): 2
+         Bytes at NS Level    ( In): 24
+         Bytes at NS Level    (Out): 10
     VCI 0x1122, NSEI 0x1122, peer 0x01020304:3333, blocked
+         Packets at NS Level  ( In): 7
+         Packets at NS Level  (Out): 10
+         Bytes at NS Level    ( In): 61
+         Bytes at NS Level    (Out): 42
          NS-VC replaced other count: 1
          NS-VC changed NSEI count  : 2
 
@@ -246,7 +294,15 @@
 
 Current NS-VCIs:
     VCI 0x3344, NSEI 0x1122, peer 0x00000000:0, blocked
+         Packets at NS Level  ( In): 2
+         Packets at NS Level  (Out): 2
+         Bytes at NS Level    ( In): 24
+         Bytes at NS Level    (Out): 10
     VCI 0x1122, NSEI 0x1122, peer 0x01020304:4444, blocked
+         Packets at NS Level  ( In): 8
+         Packets at NS Level  (Out): 12
+         Bytes at NS Level    ( In): 73
+         Bytes at NS Level    (Out): 52
          NS-VC replaced other count: 1
          NS-VC changed NSEI count  : 2
 
@@ -290,6 +346,10 @@
 
 Current NS-VCIs:
     VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111
+         Packets at NS Level  ( In): 4
+         Packets at NS Level  (Out): 4
+         Bytes at NS Level    ( In): 15
+         Bytes at NS Level    (Out): 12
 
 --- Setup VC 2 BSS -> SGSN ---
 
@@ -331,7 +391,15 @@
 
 Current NS-VCIs:
     VCI 0x2001, NSEI 0x2000, peer 0x01020304:2222
+         Packets at NS Level  ( In): 4
+         Packets at NS Level  (Out): 4
+         Bytes at NS Level    ( In): 15
+         Bytes at NS Level    (Out): 12
     VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111
+         Packets at NS Level  ( In): 4
+         Packets at NS Level  (Out): 4
+         Bytes at NS Level    ( In): 15
+         Bytes at NS Level    (Out): 12
 
 --- Setup VC 1 SGSN -> BSS ---
 
@@ -348,7 +416,15 @@
 
 Current NS-VCIs:
     VCI 0x2001, NSEI 0x2000, peer 0x01020304:2222
+         Packets at NS Level  ( In): 4
+         Packets at NS Level  (Out): 4
+         Bytes at NS Level    ( In): 15
+         Bytes at NS Level    (Out): 12
     VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111, blocked
+         Packets at NS Level  ( In): 5
+         Packets at NS Level  (Out): 6
+         Bytes at NS Level    ( In): 24
+         Bytes at NS Level    (Out): 25
          NS-VC Block count         : 1
 
 --- Exchange NSEI 1 + 2 links ---
@@ -369,7 +445,15 @@
 
 Current NS-VCIs:
     VCI 0x2001, NSEI 0x2000, peer 0x00000000:0, blocked, dead
+         Packets at NS Level  ( In): 5
+         Packets at NS Level  (Out): 5
+         Bytes at NS Level    ( In): 24
+         Bytes at NS Level    (Out): 24
     VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked
+         Packets at NS Level  ( In): 5
+         Packets at NS Level  (Out): 7
+         Bytes at NS Level    ( In): 24
+         Bytes at NS Level    (Out): 26
          NS-VC Block count         : 2
          NS-VC replaced other count: 1
 
@@ -390,7 +474,15 @@
 
 Current NS-VCIs:
     VCI 0x2001, NSEI 0x2000, peer 0x00000000:0, blocked, dead
+         Packets at NS Level  ( In): 5
+         Packets at NS Level  (Out): 6
+         Bytes at NS Level    ( In): 24
+         Bytes at NS Level    (Out): 36
     VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked
+         Packets at NS Level  ( In): 6
+         Packets at NS Level  (Out): 9
+         Bytes at NS Level    ( In): 33
+         Bytes at NS Level    (Out): 39
          NS-VC Block count         : 3
          NS-VC replaced other count: 1
 
@@ -434,7 +526,15 @@
 
 Current NS-VCIs:
     VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111
+         Packets at NS Level  ( In): 9
+         Packets at NS Level  (Out): 10
+         Bytes at NS Level    ( In): 39
+         Bytes at NS Level    (Out): 48
     VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked
+         Packets at NS Level  ( In): 6
+         Packets at NS Level  (Out): 9
+         Bytes at NS Level    ( In): 33
+         Bytes at NS Level    (Out): 39
          NS-VC Block count         : 3
          NS-VC replaced other count: 1
 
@@ -454,7 +554,15 @@
 
 Current NS-VCIs:
     VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111
+         Packets at NS Level  ( In): 9
+         Packets at NS Level  (Out): 10
+         Bytes at NS Level    ( In): 39
+         Bytes at NS Level    (Out): 48
     VCI 0x1001, NSEI 0xf000, peer 0x01020304:2222, blocked
+         Packets at NS Level  ( In): 7
+         Packets at NS Level  (Out): 11
+         Bytes at NS Level    ( In): 45
+         Bytes at NS Level    (Out): 49
          NS-VC Block count         : 3
          NS-VC replaced other count: 1
          NS-VC changed NSEI count  : 1
@@ -476,9 +584,19 @@
 
 Current NS-VCIs:
     VCI 0xf001, NSEI 0x1000, peer 0x01020304:2222, blocked
+         Packets at NS Level  (Out): 2
+         Bytes at NS Level    (Out): 10
          NS-VC replaced other count: 1
     VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111
+         Packets at NS Level  ( In): 9
+         Packets at NS Level  (Out): 10
+         Bytes at NS Level    ( In): 39
+         Bytes at NS Level    (Out): 48
     VCI 0x1001, NSEI 0xf000, peer 0x00000000:0, blocked
+         Packets at NS Level  ( In): 8
+         Packets at NS Level  (Out): 11
+         Bytes at NS Level    ( In): 57
+         Bytes at NS Level    (Out): 49
          NS-VC Block count         : 3
          NS-VC replaced other count: 1
          NS-VC changed NSEI count  : 1
@@ -500,9 +618,21 @@
 
 Current NS-VCIs:
     VCI 0xf001, NSEI 0x1000, peer 0x00000000:0, blocked
+         Packets at NS Level  ( In): 1
+         Packets at NS Level  (Out): 2
+         Bytes at NS Level    ( In): 12
+         Bytes at NS Level    (Out): 10
          NS-VC replaced other count: 1
     VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111
+         Packets at NS Level  ( In): 9
+         Packets at NS Level  (Out): 10
+         Bytes at NS Level    ( In): 39
+         Bytes at NS Level    (Out): 48
     VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked
+         Packets at NS Level  ( In): 8
+         Packets at NS Level  (Out): 13
+         Bytes at NS Level    ( In): 57
+         Bytes at NS Level    (Out): 59
          NS-VC Block count         : 3
          NS-VC replaced other count: 2
          NS-VC changed NSEI count  : 2
@@ -516,9 +646,21 @@
 
 Current NS-VCIs:
     VCI 0xf001, NSEI 0x1000, peer 0x00000000:0, blocked
+         Packets at NS Level  ( In): 1
+         Packets at NS Level  (Out): 2
+         Bytes at NS Level    ( In): 12
+         Bytes at NS Level    (Out): 10
          NS-VC replaced other count: 1
     VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111
+         Packets at NS Level  ( In): 9
+         Packets at NS Level  (Out): 10
+         Bytes at NS Level    ( In): 39
+         Bytes at NS Level    (Out): 48
     VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked
+         Packets at NS Level  ( In): 9
+         Packets at NS Level  (Out): 13
+         Bytes at NS Level    ( In): 66
+         Bytes at NS Level    (Out): 59
          NS-VC Block count         : 3
          NS-VC replaced other count: 2
          NS-VC changed NSEI count  : 2
@@ -538,9 +680,21 @@
 
 Current NS-VCIs:
     VCI 0xf001, NSEI 0x1000, peer 0x00000000:0, blocked
+         Packets at NS Level  ( In): 1
+         Packets at NS Level  (Out): 2
+         Bytes at NS Level    ( In): 12
+         Bytes at NS Level    (Out): 10
          NS-VC replaced other count: 1
     VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111
+         Packets at NS Level  ( In): 9
+         Packets at NS Level  (Out): 10
+         Bytes at NS Level    ( In): 39
+         Bytes at NS Level    (Out): 48
     VCI 0x1001, NSEI 0xf000, peer 0x01020304:2222, blocked
+         Packets at NS Level  ( In): 10
+         Packets at NS Level  (Out): 15
+         Bytes at NS Level    ( In): 75
+         Bytes at NS Level    (Out): 72
          NS-VC Block count         : 4
          NS-VC replaced other count: 2
          NS-VC changed NSEI count  : 3
@@ -561,10 +715,22 @@
 
 Current NS-VCIs:
     VCI 0xf001, NSEI 0x1000, peer 0x01020304:2222, blocked
+         Packets at NS Level  ( In): 1
+         Packets at NS Level  (Out): 3
+         Bytes at NS Level    ( In): 12
+         Bytes at NS Level    (Out): 11
          NS-VC Block count         : 1
          NS-VC replaced other count: 2
     VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111
+         Packets at NS Level  ( In): 9
+         Packets at NS Level  (Out): 10
+         Bytes at NS Level    ( In): 39
+         Bytes at NS Level    (Out): 48
     VCI 0x1001, NSEI 0xf000, peer 0x00000000:0, blocked, dead
+         Packets at NS Level  ( In): 11
+         Packets at NS Level  (Out): 16
+         Bytes at NS Level    ( In): 84
+         Bytes at NS Level    (Out): 84
          NS-VC Block count         : 4
          NS-VC replaced other count: 2
          NS-VC changed NSEI count  : 3
@@ -619,10 +785,22 @@
 
 Current NS-VCIs:
     VCI 0xf001, NSEI 0x1000, peer 0x00000000:0, blocked
+         Packets at NS Level  ( In): 2
+         Packets at NS Level  (Out): 3
+         Bytes at NS Level    ( In): 24
+         Bytes at NS Level    (Out): 11
          NS-VC Block count         : 1
          NS-VC replaced other count: 2
     VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111
+         Packets at NS Level  ( In): 9
+         Packets at NS Level  (Out): 10
+         Bytes at NS Level    ( In): 39
+         Bytes at NS Level    (Out): 48
     VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222
+         Packets at NS Level  ( In): 15
+         Packets at NS Level  (Out): 21
+         Bytes at NS Level    ( In): 88
+         Bytes at NS Level    (Out): 108
          NS-VC Block count         : 4
          NS-VC replaced other count: 3
          NS-VC changed NSEI count  : 4
@@ -645,13 +823,26 @@
 
 Current NS-VCIs:
     VCI 0xf001, NSEI 0x1000, peer 0x00000000:0, blocked
+         Packets at NS Level  ( In): 2
+         Packets at NS Level  (Out): 3
+         Bytes at NS Level    ( In): 24
+         Bytes at NS Level    (Out): 11
          NS-VC Block count         : 1
          NS-VC replaced other count: 2
     VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111
+         Packets at NS Level  ( In): 9
+         Packets at NS Level  (Out): 10
+         Bytes at NS Level    ( In): 39
+         Bytes at NS Level    (Out): 48
     VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked
+         Packets at NS Level  ( In): 17
+         Packets at NS Level  (Out): 23
+         Bytes at NS Level    ( In): 106
+         Bytes at NS Level    (Out): 121
          NS-VC Block count         : 5
          NS-VC replaced other count: 3
          NS-VC changed NSEI count  : 4
+         RESET ACK missing count   : 1
 
 Current NS-VCIs:
 
@@ -684,6 +875,10 @@
 
 Current NS-VCIs:
     VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000
+         Packets at NS Level  ( In): 3
+         Packets at NS Level  (Out): 3
+         Bytes at NS Level    ( In): 11
+         Bytes at NS Level    (Out): 14
          NS-VC Block count         : 1
 
 --- RESET, SGSN -> BSS ---
@@ -702,6 +897,10 @@
 
 Current NS-VCIs:
     VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked
+         Packets at NS Level  ( In): 4
+         Packets at NS Level  (Out): 5
+         Bytes at NS Level    ( In): 23
+         Bytes at NS Level    (Out): 24
          NS-VC Block count         : 1
 
 --- RESET with invalid NSEI, SGSN -> BSS ---
@@ -717,6 +916,10 @@
 
 Current NS-VCIs:
     VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked
+         Packets at NS Level  ( In): 5
+         Packets at NS Level  (Out): 6
+         Bytes at NS Level    ( In): 35
+         Bytes at NS Level    (Out): 33
          NS-VC Block count         : 1
          NSEI was invalid count    : 1
 
@@ -733,6 +936,10 @@
 
 Current NS-VCIs:
     VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked
+         Packets at NS Level  ( In): 6
+         Packets at NS Level  (Out): 7
+         Bytes at NS Level    ( In): 47
+         Bytes at NS Level    (Out): 42
          NS-VC Block count         : 1
          NS-VCI was invalid count  : 1
          NSEI was invalid count    : 1
@@ -753,6 +960,10 @@
 
 Current NS-VCIs:
     VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked
+         Packets at NS Level  ( In): 7
+         Packets at NS Level  (Out): 9
+         Bytes at NS Level    ( In): 59
+         Bytes at NS Level    (Out): 52
          NS-VC Block count         : 1
          NS-VCI was invalid count  : 1
          NSEI was invalid count    : 1
@@ -766,6 +977,10 @@
 
 Current NS-VCIs:
     VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked
+         Packets at NS Level  ( In): 8
+         Packets at NS Level  (Out): 9
+         Bytes at NS Level    ( In): 68
+         Bytes at NS Level    (Out): 52
          NS-VC Block count         : 1
          NS-VCI was invalid count  : 1
          NSEI was invalid count    : 1
@@ -783,6 +998,10 @@
 
 Current NS-VCIs:
     VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked, dead
+         Packets at NS Level  ( In): 9
+         Packets at NS Level  (Out): 10
+         Bytes at NS Level    ( In): 77
+         Bytes at NS Level    (Out): 64
          NS-VC Block count         : 1
          NS-VCI was invalid count  : 1
          NSEI was invalid count    : 2
@@ -800,6 +1019,10 @@
 
 Current NS-VCIs:
     VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked, dead
+         Packets at NS Level  ( In): 10
+         Packets at NS Level  (Out): 11
+         Bytes at NS Level    ( In): 86
+         Bytes at NS Level    (Out): 76
          NS-VC Block count         : 1
          NS-VCI was invalid count  : 2
          NSEI was invalid count    : 2
@@ -836,6 +1059,10 @@
 
 Current NS-VCIs:
     VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000
+         Packets at NS Level  ( In): 3
+         Packets at NS Level  (Out): 3
+         Bytes at NS Level    ( In): 11
+         Bytes at NS Level    (Out): 14
          NS-VC Block count         : 1
 
 --- Time out local test procedure ---
@@ -939,6 +1166,8 @@
 
 Current NS-VCIs:
     VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked, dead
+         Packets at NS Level  (Out): 1
+         Bytes at NS Level    (Out): 12
 
 --- Send message to SGSN ---
 
@@ -968,6 +1197,10 @@
 
 Current NS-VCIs:
     VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked
+         Packets at NS Level  ( In): 2
+         Packets at NS Level  (Out): 3
+         Bytes at NS Level    ( In): 10
+         Bytes at NS Level    (Out): 14
          NS-VC Block count         : 1
 
 --- Send message to SGSN ---
@@ -996,6 +1229,10 @@
 
 Current NS-VCIs:
     VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000
+         Packets at NS Level  ( In): 4
+         Packets at NS Level  (Out): 4
+         Bytes at NS Level    ( In): 12
+         Bytes at NS Level    (Out): 15
          NS-VC Block count         : 1
 
 --- Send message to SGSN ---
diff --git a/tests/stats/stats_test.ok b/tests/stats/stats_test.ok
index a0c001b..cb9daf2 100644
--- a/tests/stats/stats_test.ok
+++ b/tests/stats/stats_test.ok
@@ -2,14 +2,14 @@
   test1: open
   test2: open
 report (initial):
-  test2: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
-  test1: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
-  test2: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
-  test1: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
-  test2: counter p= g=ctr-test.one i=1 n=ctr.a v=0 d=0
-  test1: counter p= g=ctr-test.one i=1 n=ctr.a v=0 d=0
-  test2: counter p= g=ctr-test.one i=1 n=ctr.b v=0 d=0
-  test1: counter p= g=ctr-test.one i=1 n=ctr.b v=0 d=0
+  test2: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+  test1: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+  test2: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
+  test1: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
+  test2: counter p= g=ctr-test:one i=1 n=ctr:a v=0 d=0
+  test1: counter p= g=ctr-test:one i=1 n=ctr:a v=0 d=0
+  test2: counter p= g=ctr-test:one i=1 n=ctr:b v=0 d=0
+  test1: counter p= g=ctr-test:one i=1 n=ctr:b v=0 d=0
   test2: item p= g=test.one i=2 n=item.a v=-1 u=ma
   test1: item p= g=test.one i=2 n=item.a v=-1 u=ma
   test2: item p= g=test.one i=2 n=item.b v=-1 u=kb
@@ -19,19 +19,19 @@
   test2: item p= g=test.one i=1 n=item.b v=-1 u=kb
   test1: item p= g=test.one i=1 n=item.b v=-1 u=kb
 report (srep1 global):
-  test2: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
-  test2: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
-  test2: counter p= g=ctr-test.one i=1 n=ctr.a v=0 d=0
-  test2: counter p= g=ctr-test.one i=1 n=ctr.b v=0 d=0
+  test2: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+  test2: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
+  test2: counter p= g=ctr-test:one i=1 n=ctr:a v=0 d=0
+  test2: counter p= g=ctr-test:one i=1 n=ctr:b v=0 d=0
   test2: item p= g=test.one i=2 n=item.a v=-1 u=ma
   test2: item p= g=test.one i=2 n=item.b v=-1 u=kb
   test2: item p= g=test.one i=1 n=item.a v=-1 u=ma
   test2: item p= g=test.one i=1 n=item.b v=-1 u=kb
 report (srep1 peer):
-  test2: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
-  test2: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
-  test2: counter p= g=ctr-test.one i=1 n=ctr.a v=0 d=0
-  test2: counter p= g=ctr-test.one i=1 n=ctr.b v=0 d=0
+  test2: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+  test2: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
+  test2: counter p= g=ctr-test:one i=1 n=ctr:a v=0 d=0
+  test2: counter p= g=ctr-test:one i=1 n=ctr:b v=0 d=0
   test2: item p= g=test.one i=2 n=item.a v=-1 u=ma
   test1: item p= g=test.one i=2 n=item.a v=-1 u=ma
   test2: item p= g=test.one i=2 n=item.b v=-1 u=kb
@@ -41,14 +41,14 @@
   test2: item p= g=test.one i=1 n=item.b v=-1 u=kb
   test1: item p= g=test.one i=1 n=item.b v=-1 u=kb
 report (srep1 subscriber):
-  test2: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
-  test1: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
-  test2: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
-  test1: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
-  test2: counter p= g=ctr-test.one i=1 n=ctr.a v=0 d=0
-  test1: counter p= g=ctr-test.one i=1 n=ctr.a v=0 d=0
-  test2: counter p= g=ctr-test.one i=1 n=ctr.b v=0 d=0
-  test1: counter p= g=ctr-test.one i=1 n=ctr.b v=0 d=0
+  test2: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+  test1: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+  test2: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
+  test1: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
+  test2: counter p= g=ctr-test:one i=1 n=ctr:a v=0 d=0
+  test1: counter p= g=ctr-test:one i=1 n=ctr:a v=0 d=0
+  test2: counter p= g=ctr-test:one i=1 n=ctr:b v=0 d=0
+  test1: counter p= g=ctr-test:one i=1 n=ctr:b v=0 d=0
   test2: item p= g=test.one i=2 n=item.a v=-1 u=ma
   test1: item p= g=test.one i=2 n=item.a v=-1 u=ma
   test2: item p= g=test.one i=2 n=item.b v=-1 u=kb
@@ -59,49 +59,49 @@
   test1: item p= g=test.one i=1 n=item.b v=-1 u=kb
 report (srep2 disabled):
   test2: close
-  test1: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
-  test1: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
-  test1: counter p= g=ctr-test.one i=1 n=ctr.a v=0 d=0
-  test1: counter p= g=ctr-test.one i=1 n=ctr.b v=0 d=0
+  test1: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+  test1: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
+  test1: counter p= g=ctr-test:one i=1 n=ctr:a v=0 d=0
+  test1: counter p= g=ctr-test:one i=1 n=ctr:b v=0 d=0
   test1: item p= g=test.one i=2 n=item.a v=-1 u=ma
   test1: item p= g=test.one i=2 n=item.b v=-1 u=kb
   test1: item p= g=test.one i=1 n=item.a v=-1 u=ma
   test1: item p= g=test.one i=1 n=item.b v=-1 u=kb
 report (srep2 enabled, no flush forced):
   test2: open
-  test2: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
-  test2: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
-  test2: counter p= g=ctr-test.one i=1 n=ctr.a v=0 d=0
-  test2: counter p= g=ctr-test.one i=1 n=ctr.b v=0 d=0
+  test2: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+  test2: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
+  test2: counter p= g=ctr-test:one i=1 n=ctr:a v=0 d=0
+  test2: counter p= g=ctr-test:one i=1 n=ctr:b v=0 d=0
   test2: item p= g=test.one i=2 n=item.a v=-1 u=ma
   test2: item p= g=test.one i=2 n=item.b v=-1 u=kb
   test2: item p= g=test.one i=1 n=item.a v=-1 u=ma
   test2: item p= g=test.one i=1 n=item.b v=-1 u=kb
 report (should be empty):
 report (group 1, counter 1 update):
-  test2: counter p= g=ctr-test.one i=1 n=ctr.a v=1 d=1
-  test1: counter p= g=ctr-test.one i=1 n=ctr.a v=1 d=1
+  test2: counter p= g=ctr-test:one i=1 n=ctr:a v=1 d=1
+  test1: counter p= g=ctr-test:one i=1 n=ctr:a v=1 d=1
 report (group 1, item 1 update):
   test2: item p= g=test.one i=1 n=item.a v=10 u=ma
   test1: item p= g=test.one i=1 n=item.a v=10 u=ma
 report (remove statg1, ctrg1):
-  test2: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
-  test1: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
-  test2: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
-  test1: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
+  test2: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+  test1: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+  test2: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
+  test1: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
   test2: item p= g=test.one i=2 n=item.a v=-1 u=ma
   test1: item p= g=test.one i=2 n=item.a v=-1 u=ma
   test2: item p= g=test.one i=2 n=item.b v=-1 u=kb
   test1: item p= g=test.one i=2 n=item.b v=-1 u=kb
 report (remove srep1):
   test1: close
-  test2: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
-  test2: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
+  test2: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+  test2: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
   test2: item p= g=test.one i=2 n=item.a v=-1 u=ma
   test2: item p= g=test.one i=2 n=item.b v=-1 u=kb
 report (remove statg2):
-  test2: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
-  test2: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
+  test2: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+  test2: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
 report (remove srep2):
   test2: close
 report (remove ctrg2, should be empty):

-- 
To view, visit https://gerrit.osmocom.org/4130
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ifc6ac824f5dae9a848bb4a5d067c64a69eb40b56
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list