From owner-svn-src-all@FreeBSD.ORG Fri Oct 12 02:10:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C1BD1DD4; Fri, 12 Oct 2012 02:10:27 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 90E6C8FC0A; Fri, 12 Oct 2012 02:10:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9C2ARtb023552; Fri, 12 Oct 2012 02:10:27 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9C2AR5h023548; Fri, 12 Oct 2012 02:10:27 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201210120210.q9C2AR5h023548@svn.freebsd.org> From: Eitan Adler Date: Fri, 12 Oct 2012 02:10:27 +0000 (UTC) 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 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 02:10:27 -0000 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 */