Hi, * ☎ <[email protected]> [2012-09-21 15:12]: > 21.09.2012 09:24, Harald Welte пишет: > > > > It should be -d DGPRS, but I suggest you rather configure logging for > > stdout or for your given telnet session via VTY. > > > > I suggest to enable debug for NS, BSSGP, LLC, (G)MM > Sadly with latest libosmocore from git I got segfault in > log_parse_category_mask() > with osmo-sgsn --debug=DNS:DGPRS:DNS:DBSSGP:DLLC:DMM:DGMM
This seems to be caused by a bug in libosmocore. I'm actually surprised that nobody encountered this crash before. The reason is that log_parse_category_mask() checks for osmo_log_info->cat[i].name being NULL after passing the pointer to strlen. Attached is a patch to fix this. Cheers Nico
>From 7ef480771ad3ef8e225ed59c6848e59e625bcd0f Mon Sep 17 00:00:00 2001 From: Nico Golde <[email protected]> Date: Fri, 21 Sep 2012 17:44:58 +0200 Subject: [PATCH] logging.c: log_parse_category_mask(), skip log category name right away if name is NULL to prevent passing a NULL ptr to strlen --- src/logging.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/logging.c b/src/logging.c index 0816570..f368bea 100644 --- a/src/logging.c +++ b/src/logging.c @@ -167,6 +167,7 @@ void log_parse_category_mask(struct log_target* target, const char *_mask) int i = 0; char *mask = strdup(_mask); char *category_token = NULL; + size_t length, cat_length; /* Disable everything to enable it afterwards */ for (i = 0; i < osmo_log_info->num_cat; ++i) @@ -176,16 +177,17 @@ void log_parse_category_mask(struct log_target* target, const char *_mask) do { for (i = 0; i < osmo_log_info->num_cat; ++i) { char* colon = strstr(category_token, ","); - int length = strlen(category_token); - int cat_length = strlen(osmo_log_info->cat[i].name); + + if (!osmo_log_info->cat[i].name) + continue; + + length = strlen(category_token); + cat_length = strlen(osmo_log_info->cat[i].name); /* Use longest length not to match subocurrences. */ if (cat_length > length) length = cat_length; - if (!osmo_log_info->cat[i].name) - continue; - if (colon) length = colon - category_token; -- 1.7.10.4
