neels has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/38020?usp=email )


Change subject: rate_ctr,CTRL[2/2]: log ctrg inst names invalid for CTRL
......................................................................

rate_ctr,CTRL[2/2]: log ctrg inst names invalid for CTRL

After the previous patch, magically all rate_ctr_groups in all osmo
programs will become accessible by their given rate_ctr_group_set_name()
IDs.

This also means that the strings passed to rate_ctr_group_set_name() now
are required to be a valid identifier, to not mix up the CTRL interface
syntax.

So far, only log an error, to figure out if we need mangling.

Related: OS#6545
Change-Id: Ic721219649e20960c7af5765ee4d3b641fef5081
---
M src/core/rate_ctr.c
1 file changed, 6 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/20/38020/1

diff --git a/src/core/rate_ctr.c b/src/core/rate_ctr.c
index 8b4c42c..f9713d4 100644
--- a/src/core/rate_ctr.c
+++ b/src/core/rate_ctr.c
@@ -279,6 +279,12 @@
  */
 void rate_ctr_group_set_name(struct rate_ctr_group *grp, const char *name)
 {
+       /* The name is exposed on the CTRL interface as identifier, see 
control_if.c get_rate_ctr(). If we see this
+        * error showing up in our applications, we will know that we'll have 
to fix the code to sanitize this string
+        * one way or another (not decided yet whether here or in the calling 
application). */
+       if (name && !osmo_identifier_valid(name))
+               LOGP(DLGLOBAL, LOGL_ERROR, "The application is setting an 
invalid rate counter group name: %s\n",
+                    osmo_quote_str(name, -1));
        osmo_talloc_replace_string(grp, &grp->name, name);
 }


-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/38020?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ic721219649e20960c7af5765ee4d3b641fef5081
Gerrit-Change-Number: 38020
Gerrit-PatchSet: 1
Gerrit-Owner: neels <[email protected]>

Reply via email to