aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2018-01-04 12:25:57 +0100
committerHarald Welte <laforge@gnumonks.org>2018-01-05 10:08:04 +0000
commit2f153b5020f4f15784b57e0aabb72fc2085b2448 (patch)
tree1d2f96d5c06cfd210a454c2e12add2f37e9b6d5d /src
parentff2eedac0f8c839ecb213f23a8e8e7d045afba7b (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/vty/logging_vty.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c
index c39017b9..dc457ffc 100644
--- a/src/vty/logging_vty.c
+++ b/src/vty/logging_vty.c
@@ -537,7 +537,7 @@ DEFUN(cfg_log_gsmtap, cfg_log_gsmtap_cmd,
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 @@ DEFUN(cfg_log_gsmtap, cfg_log_gsmtap_cmd,
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);