Re: CURRENT [r309933] broke syslogd on IPv4 only system

2017-01-28 Thread Hiroki Sato
Hi,

Alex Deiter  wrote
  in :

al> Hello,
al>
al> Please take a look SVN r309933:

(snip)

al> Successfully tested on IPv4-only CURRENT r312856M.

 Thank you for your report.  r312921 should fix this problem.  Please
 let me know if you still find something wrong with the latest
 version.

-- Hiroki


pgp201AQK1OwO.pgp
Description: PGP signature


CURRENT [r309933] broke syslogd on IPv4 only system

2017-01-28 Thread Alex Deiter
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 .
- 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 syslogd19151 6  udp4   *:514 *:*

# ls -l /var/run/ |grep log
-rw---  1 root   wheel5 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.dei...@gmail.com



___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"