Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Oct 2012 02:10:27 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r241473 - stable/9/usr.sbin/syslogd
Message-ID:  <201210120210.q9C2AR5h023548@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Fri Oct 12 02:10:27 2012
New Revision: 241473
URL: http://svn.freebsd.org/changeset/base/241473

Log:
  MFC r240389,r240409:
  - 	Add support for ipv6 addresses as destination
  - 	Add documentation for IPv6 support
  
  PR:		docs/171580
  Approved by:	cperciva (implicit)

Modified:
  stable/9/usr.sbin/syslogd/syslog.conf.5
  stable/9/usr.sbin/syslogd/syslogd.c
Directory Properties:
  stable/9/usr.sbin/syslogd/   (props changed)

Modified: stable/9/usr.sbin/syslogd/syslog.conf.5
==============================================================================
--- stable/9/usr.sbin/syslogd/syslog.conf.5	Fri Oct 12 02:10:26 2012	(r241472)
+++ stable/9/usr.sbin/syslogd/syslog.conf.5	Fri Oct 12 02:10:27 2012	(r241473)
@@ -28,7 +28,7 @@
 .\"     @(#)syslog.conf.5	8.1 (Berkeley) 6/9/93
 .\" $FreeBSD$
 .\"
-.Dd December 23, 2008
+.Dd September 12, 2012
 .Dt SYSLOG.CONF 5
 .Os
 .Sh NAME
@@ -347,6 +347,14 @@ If a port number is added after a colon
 .Pq Ql :\&
 then that port will be used as the destination port
 rather than the usual syslog port.
+IPv6 addresses can be used
+by surrounding the address portion with
+square brackets
+.Po
+.Ql [\&
+and
+.Ql ]\&
+.Pc .
 .It
 A comma separated list of users.
 Selected messages are written to those users

Modified: stable/9/usr.sbin/syslogd/syslogd.c
==============================================================================
--- stable/9/usr.sbin/syslogd/syslogd.c	Fri Oct 12 02:10:26 2012	(r241472)
+++ stable/9/usr.sbin/syslogd/syslogd.c	Fri Oct 12 02:10:27 2012	(r241473)
@@ -1931,6 +1931,7 @@ cfline(const char *line, struct filed *f
 	case '@':
 		{
 			char *tp;
+			char endkey = ':';
 			/*
 			 * scan forward to see if there is a port defined.
 			 * so we can't use strlcpy..
@@ -1939,9 +1940,19 @@ cfline(const char *line, struct filed *f
 			tp = f->f_un.f_forw.f_hname;
 			p++;
 
-			while (*p && (*p != ':') && (i-- > 0)) {
+			/*
+			 * an ipv6 address should start with a '[' in that case
+			 * we should scan for a ']'
+			 */
+			if (*p == '[') {
+				p++;
+				endkey = ']';
+			}
+			while (*p && (*p != endkey) && (i-- > 0)) {
 				*tp++ = *p++;
 			}
+			if (endkey == ']' && *p == endkey)
+				p++;
 			*tp = '\0';
 		}
 		/* See if we copied a domain and have a port */



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