aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libcommon/debug.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-12-28 18:54:32 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-01-02 11:43:06 +0100
commit6995f24831b70ef64bd08976f2aecc5314fe9862 (patch)
tree2d8465b045245304156394930a4ff60ad9d6cf04 /openbsc/src/libcommon/debug.c
parentb7ccac4d620271e8780fdc7640cba96c275bdf85 (diff)
logging: Only compare the subscr address
Move the "logging filter imsi IMSI" into the BTS/NITB code to allow to set the gsm_subscriber and only compare it. This way we simply compare the subscriber address and don't have to care if the subscriber data is still valid.
Diffstat (limited to 'openbsc/src/libcommon/debug.c')
-rw-r--r--openbsc/src/libcommon/debug.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/openbsc/src/libcommon/debug.c b/openbsc/src/libcommon/debug.c
index b3685e6d2..ca7ff5da6 100644
--- a/openbsc/src/libcommon/debug.c
+++ b/openbsc/src/libcommon/debug.c
@@ -177,7 +177,7 @@ static int filter_fn(const struct log_context *ctx,
const struct gprs_nsvc *bvc = ctx->ctx[GPRS_CTX_BVC];
if ((tar->filter_map & (1 << FLT_IMSI)) != 0
- && subscr && strcmp(subscr->imsi, tar->filter_data[FLT_IMSI]) == 0)
+ && subscr && subscr == tar->filter_data[FLT_IMSI])
return 1;
/* Filter on the NS Virtual Connection */
@@ -199,14 +199,18 @@ const struct log_info log_info = {
.num_cat = ARRAY_SIZE(default_categories),
};
-void log_set_imsi_filter(struct log_target *target, const char *imsi)
+void log_set_imsi_filter(struct log_target *target, struct gsm_subscriber *subscr)
{
- if (imsi) {
+ /* free the old data */
+ if (target->filter_data[FLT_IMSI]) {
+ subscr_put(target->filter_data[FLT_IMSI]);
+ target->filter_data[FLT_IMSI] = NULL;
+ }
+
+ if (subscr) {
target->filter_map |= (1 << FLT_IMSI);
- target->filter_data[FLT_IMSI] = talloc_strdup(target, imsi);
- } else if (target->filter_data[FLT_IMSI]) {
+ target->filter_data[FLT_IMSI] = subscr_get(subscr);
+ } else {
target->filter_map &= ~(1 << FLT_IMSI);
- talloc_free(target->filter_data[FLT_IMSI]);
- target->filter_data[FLT_IMSI] = NULL;
}
}