Allow multiple 'log gsmtap' sinks
Previously we've checked for existing log target with a given hostname
from vty code but it was ignored inside the check so only the very first
'log gsmtap' entry was enabled while the rest were silently ignored.
Change-Id: I8fd8bda9e07d403a54735da30addb742e56538a2
diff --git a/src/logging.c b/src/logging.c
index 1e0b21b..e4f3e87 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -745,11 +745,18 @@
llist_for_each_entry(tgt, &osmo_log_target_list, entry) {
if (tgt->type != type)
continue;
- if (tgt->type == LOG_TGT_TYPE_FILE) {
+ switch (tgt->type) {
+ case LOG_TGT_TYPE_FILE:
if (!strcmp(fname, tgt->tgt_file.fname))
return tgt;
- } else
+ break;
+ case LOG_TGT_TYPE_GSMTAP:
+ if (!strcmp(fname, tgt->tgt_gsmtap.hostname))
+ return tgt;
+ break;
+ default:
return tgt;
+ }
}
return NULL;
}