From 2f153b5020f4f15784b57e0aabb72fc2085b2448 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 4 Jan 2018 12:25:57 +0100 Subject: 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 --- src/vty/logging_vty.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') 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); -- cgit v1.2.3