Page MenuHomeFreeBSD

syslogd: fix -b use with IPv6 literal addresses after ^/head@r309933
ClosedPublic

Authored by ngie on Mar 20 2017, 4:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jan 8, 3:46 AM
Unknown Object (File)
Mon, Dec 23, 4:15 AM
Unknown Object (File)
Dec 6 2024, 6:42 PM
Unknown Object (File)
Oct 31 2024, 3:09 PM
Unknown Object (File)
Oct 3 2024, 2:24 PM
Unknown Object (File)
Oct 3 2024, 12:33 AM
Unknown Object (File)
Oct 1 2024, 1:00 PM
Unknown Object (File)
Oct 1 2024, 6:18 AM
Subscribers

Details

Summary

syslogd: fix -b use with IPv6 literal addresses after ^/head@r309933

Don't assume all -b arguments don't contain a single colon to be a
filename/hostname. Check for an additional colon in the output to see
whether or not it should be assumed to be a filename/hostname.

PR: 217939
Submitted by: ae
Sponsored by: Dell EMC Isilon

Test Plan

Positive case:

The gamut of -b arguments I added to the bug:

$ grep ^syslogd_flags= /etc/rc.conf
syslogd_flags="-b :syslog -b ::1 -b [::1]:syslog -b 127.0.0.1:syslog -b localhost -b localhost:syslog"
$ sudo service syslogd restart
syslogd not running? (check /var/run/syslog.pid).
Starting syslogd.
$ sockstat | grep syslogd
root syslogd 34368 6 udp6 *:514 *:*
root syslogd 34368 7 udp4 *:514 *:*
root syslogd 34368 8 udp6 ::1:514 *:*
root syslogd 34368 9 udp4 127.0.0.1:514 *:*
root syslogd 34368 10 dgram /var/run/log
root syslogd 34368 11 dgram /var/run/logpriv

IN6ADDR_ANY[_INIT]:

$ sudo syslogd -b ::
$ sockstat | grep syslogd
root syslogd 34436 6 udp6 *:514 *:*
root syslogd 34436 7 dgram /var/run/log
root syslogd 34436 8 dgram /var/run/logpriv

INADDR_ANY:

$ sudo syslogd -s -b 0.0.0.0
$ sockstat | grep syslogd
root syslogd 34443 6 udp4 *:514 *:*
root syslogd 34443 7 dgram /var/run/log
root syslogd 34443 8 dgram /var/run/logpriv

Negative cases:

$ sudo syslogd -s -b ::1:syslog -d
Trying peer: ::1:syslog
syslogd: getaddrinfo failed for ::1:syslogsyslog: hostname nor servname provided, or not known
logmsg: pri 53, flags 4, from , msg syslogd: getaddrinfo failed for ::1:syslogsyslog: hostname nor servname provided, or not known
Logging to UNUSED

$ sudo syslogd -s -b 127.0.0.1::syslog -d
Trying peer: 127.0.0.1::syslog
syslogd: getaddrinfo failed for 127.0.0.1::syslogsyslog: hostname nor servname provided, or not known
logmsg: pri 53, flags 4, from , msg syslogd: getaddrinfo failed for 127.0.0.1::syslogsyslog: hostname nor servname provided, or not known
Logging to UNUSED

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable