Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Dec 2016 05:28:30 +0000 (UTC)
From:      Hiroki Sato <hrs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r310384 - head/usr.sbin/syslogd
Message-ID:  <201612220528.uBM5SUr1059016@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hrs
Date: Thu Dec 22 05:28:30 2016
New Revision: 310384
URL: https://svnweb.freebsd.org/changeset/base/310384

Log:
  Fix debug log in the case of AF_INET6.

Modified:
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.c
==============================================================================
--- head/usr.sbin/syslogd/syslogd.c	Thu Dec 22 05:23:38 2016	(r310383)
+++ head/usr.sbin/syslogd/syslogd.c	Thu Dec 22 05:28:30 2016	(r310384)
@@ -1262,17 +1262,23 @@ fprintlog(struct filed *f, int flags, co
 	f->f_time = now;
 
 	switch (f->f_type) {
-		int port;
 	case F_UNUSED:
 		dprintf("\n");
 		break;
 
 	case F_FORW:
-		port = ntohs(satosin(f->fu_forw_addr->ai_addr)->sin_port);
-		if (port != 514) {
-			dprintf(" %s:%d\n", f->fu_forw_hname, port);
-		} else {
-			dprintf(" %s\n", f->fu_forw_hname);
+		dprintf(" %s", f->fu_forw_hname);
+		switch (f->fu_forw_addr->ai_addr->sa_family) {
+		case AF_INET:
+			dprintf(":%d\n",
+			    ntohs(satosin(f->fu_forw_addr->ai_addr)->sin_port));
+			break;
+#ifdef INET6
+		case AF_INET6:
+			dprintf(":%d\n",
+			    ntohs(satosin6(f->fu_forw_addr->ai_addr)->sin6_port));
+			break;
+#endif
 		}
 		/* check for local vs remote messages */
 		if (strcasecmp(f->f_prevhost, LocalHostName))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612220528.uBM5SUr1059016>