[PATCH] libosmocore[master]: Use 127.0.0.1 for GSMTAP logging by default

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 4 11:53:14 UTC 2018


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

Use 127.0.0.1 for GSMTAP logging by default

Previously the were no default value provided in case of unspecified
hostname in "log gsmtap" vty config. This leads to confusing log
messages because NULL was used as a hostname:
Inconsistent indentation -- leading whitespace must match adjacent lines, and
indentation must reflect child node levels. A mix of tabs and spaces is
allowed, but their sequence must not change within a child block.

Fix this by using 127.0.0.1 as default log destination and logging
hostname in case of errors.

Related: OS#2608
Change-Id: I58b1d4ec522af18024be2e56c9103b3db7936813
---
M src/vty/logging_vty.c
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/40/5640/1

diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c
index c39017b..dc457ff 100644
--- a/src/vty/logging_vty.c
+++ b/src/vty/logging_vty.c
@@ -537,7 +537,7 @@
 	LOG_STR "Logging via GSMTAP\n"
 	"Host name to send the GSMTAP logging to (UDP port 4729)\n")
 {
-	const char *hostname = argv[0];
+	const char *hostname = argc ? argv[0] : "127.0.0.1";
 	struct log_target *tgt;
 
 	tgt = log_target_find(LOG_TGT_TYPE_GSMTAP, hostname);
@@ -546,8 +546,8 @@
 					       host.app_info->name, false,
 					       true);
 		if (!tgt) {
-			vty_out(vty, "%% Unable to create GSMTAP log%s",
-				VTY_NEWLINE);
+			vty_out(vty, "%% Unable to create GSMTAP log for %s%s",
+				hostname, VTY_NEWLINE);
 			return CMD_WARNING;
 		}
 		log_add_target(tgt);

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

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



More information about the gerrit-log mailing list