[PATCH] libosmocore[master]: Allow multiple 'log gsmtap' sinks

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/.

Max gerrit-no-reply at lists.osmocom.org
Thu Jan 11 10:03:40 UTC 2018


Review at  https://gerrit.osmocom.org/5747

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
---
M src/logging.c
1 file changed, 9 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/47/5747/1

diff --git a/src/logging.c b/src/logging.c
index 20ec443..0f65b39 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;
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8fd8bda9e07d403a54735da30addb742e56538a2
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list