summaryrefslogtreecommitdiffstats
path: root/usr.sbin/syslogd
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2012-09-12 10:39:47 +0000
committerbapt <bapt@FreeBSD.org>2012-09-12 10:39:47 +0000
commitfcd6b4b1cb0bd22d24627b7784e9ef476f49616a (patch)
tree57e38114170df5878d3078ee65549717e4898dfa /usr.sbin/syslogd
parent002ed15d64eaaea6541ae8161846ac2f05e1cf5d (diff)
downloadFreeBSD-src-fcd6b4b1cb0bd22d24627b7784e9ef476f49616a.zip
FreeBSD-src-fcd6b4b1cb0bd22d24627b7784e9ef476f49616a.tar.gz
Add support for ipv6 addresses as destination
PR: bin/150530 Submitted by: andy white <andywhite@gmail.com> Tested by: Olivier Cochard-Labbe <olivier@cochard.me> MFC after: 1 month
Diffstat (limited to 'usr.sbin/syslogd')
-rw-r--r--usr.sbin/syslogd/syslogd.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index d1c9fd1..2f42975 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -1931,6 +1931,7 @@ cfline(const char *line, struct filed *f, const char *prog, const char *host)
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, const char *prog, const char *host)
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 */
OpenPOWER on IntegriCloud