Author: bapt
Date: Wed Sep 12 10:39:47 2012
New Revision: 240389
URL: http://svn.freebsd.org/changeset/base/240389

Log:
  Add support for ipv6 addresses as destination
  
  PR:           bin/150530
  Submitted by: andy white <andywh...@gmail.com>
  Tested by:    Olivier Cochard-Labbe <oliv...@cochard.me>
  MFC after:    1 month

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

Modified: head/usr.sbin/syslogd/syslogd.c
==============================================================================
--- head/usr.sbin/syslogd/syslogd.c     Wed Sep 12 10:16:39 2012        
(r240388)
+++ head/usr.sbin/syslogd/syslogd.c     Wed Sep 12 10:39:47 2012        
(r240389)
@@ -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 */
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to