CURRENT [r309933] broke syslogd on IPv4 only system
Alex Deiter
alex.deiter at gmail.com
Sat Jan 28 11:43:02 UTC 2017
Hello,
Please take a look SVN r309933:
------------------------------------------------------------------------
r309933 | hrs | 2016-12-12 22:33:40 +0300 (Mon, 12 Dec 2016) | 13 lines
- Refactor listening socket list. All of the listening sockets are
now maintained in a single linked-list in a transport-independent manner.
- Use queue.h for linked-list structure.
- Use linked-list for AllowedPeers.
- Use getaddrinfo(8) even for Unix Domain sockets.
- Use macros to type-casting from/to struct sockaddr{,_in,_in6}.
- Define fu_* macro for union f_un to shorten the member names.
- Remove an extra #include <sys/type.h>.
- Add "static" to non-exported symbols.
- !INET support is still incomplete but will be fixed later.
There is no functional change except for some minor debug messages.
------------------------------------------------------------------------
After this change syslogd is not listen on local sockets:
# /usr/sbin/syslogd -d
Try (null)
new socket fd is 6
shutdown
sending on socket
Try /var/run/log
Try /var/run/logpriv
off & running....
init
loading timezone data via tzset()
. . .
# sockstat | grep syslogd
root syslogd 19151 6 udp4 *:514 *:*
# ls -l /var/run/ |grep log
-rw------- 1 root wheel 5 Jan 28 14:30 syslog.pid
Root cause:
usr.sbin/syslogd/syslogd.c
. . .
309 #ifdef INET6
310 static int family = PF_UNSPEC; /* protocol family (IPv4, IPv6 or both) */
311 #else
312 static int family = PF_INET; /* protocol family (IPv4 only) */
313 #endif
. . .
2856 static int
2857 socksetup(struct peer *pe)
. . .
2911 if (family != AF_UNSPEC && res->ai_family != family)
2912 continue;
in case of IPv4-only system (WITHOUT_INET6=YES in /etc/src.conf) we have family = PF_INET in 312 line and function socksetup will skip listen on local sockets.
Proposed patch:
Index: syslogd.c
===================================================================
--- syslogd.c (revision 312909)
+++ syslogd.c (working copy)
@@ -2908,7 +2908,7 @@
/* Only AF_LOCAL in secure mode. */
continue;
}
- if (family != AF_UNSPEC && res->ai_family != family)
+ if (res->ai_family != AF_LOCAL && res->ai_family != family)
continue;
s = socket(res->ai_family, res->ai_socktype,
Successfully tested on IPv4-only CURRENT r312856M.
Thank you!
Alex Deiter
alex.deiter at gmail.com
More information about the freebsd-current
mailing list