Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Sep 2010 14:26:46 GMT
From:      andy white <andywhite@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/150530: syslogd doesn't support ipv6 addrs as destination (patch included)
Message-ID:  <201009131426.o8DEQkPF085815@www.freebsd.org>
Resent-Message-ID: <201009131430.o8DEU6fP012798@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         150530
>Category:       misc
>Synopsis:       syslogd doesn't support ipv6 addrs as destination (patch included)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 13 14:30:05 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     andy white
>Release:        6.4 (also verified in 8.0)
>Organization:
>Environment:
FreeBSD fbsd64.x.local 6.4-RELEASE FreeBSD 6.4-RELEASE #0: Wed Nov 26 11:43:51 UTC 2008     root@dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
using a ipv4 or hostname (resolves to AAAA or A ) target works fine like this

local7.* @hostname or local7.* @192.168.1.1

but using a v6 address doesn't , like this

local7.* @2001:770:1cc:caab:2a0:77ff:f403:8398 or local7.* @[2001:770:1cc:caab:2a0:77ff:f403:8398]

This is because syslogd.c uses colon as the port separator and this get's broken as a v6 address has colons within it.
>How-To-Repeat:

use this

local7.* @[2001:770:1cc:caab:2a0:77ff:f403:8398]  

in your syslog.conf
>Fix:
Attached is a patch to parse an ipv6 address correctly. ipv6 address must be enclosed in square brackets [] inline with rfc3986. Patch is against 8.0

so valid syslog.conf entries are


local7.* @[2001:770:1cc:caab:2a0:77ff:f403:8398]  

and


local7.* @[2001:770:1cc:caab:2a0:77ff:f403:8398]:514

etc.

Patch attached with submission follows:

1936c1936
< 			while (*p && (*p != ':') && (i-- > 0)) {
---
> 			while (*p && (*p != ':') && (*p != '[') && (i-- > 0)) {
1938a1939,1945
> 			if (*p == '[') {
> 				p++;
> 				while (*p && (*p != ']') && (i-- > 0)) {
> 					*tp++ = *p++;
> 				}
> 				p++;
> 			}			


>Release-Note:
>Audit-Trail:
>Unformatted:



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