misc/150530: syslogd doesn't support ipv6 addrs as destination (patch included)

andy white andywhite at gmail.com
Mon Sep 13 14:30:06 UTC 2010


>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 at 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:


More information about the freebsd-bugs mailing list