Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Jan 2017 14:42:58 +0300
From:      Alex Deiter <alex.deiter@gmail.com>
To:        freebsd-current <freebsd-current@freebsd.org>
Subject:   CURRENT [r309933] broke syslogd on IPv4 only system
Message-ID:  <F18D421C-6E3F-4A65-AF18-708B9DAEFFBD@gmail.com>

next in thread | raw e-mail | index | archive | help
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 =3D PF_UNSPEC; /* protocol family (IPv4, =
IPv6 or both) */
    311 #else
    312 static int      family =3D PF_INET; /* protocol family (IPv4 =
only) */
    313 #endif
. . .
   2856 static int
   2857 socksetup(struct peer *pe)
. . .
2911                 if (family !=3D AF_UNSPEC && res->ai_family !=3D =
family)
   2912                         continue;

in case of IPv4-only system (WITHOUT_INET6=3DYES in /etc/src.conf) we =
have family =3D PF_INET in 312 line and function socksetup will skip =
listen on local sockets.

Proposed patch:

Index: syslogd.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- syslogd.c   (revision 312909)
+++ syslogd.c   (working copy)
@@ -2908,7 +2908,7 @@
                        /* Only AF_LOCAL in secure mode. */
                        continue;
                }
-               if (family !=3D AF_UNSPEC && res->ai_family !=3D family)
+               if (res->ai_family !=3D AF_LOCAL && res->ai_family !=3D =
family)
                        continue;

                s =3D socket(res->ai_family, res->ai_socktype,

Successfully tested on IPv4-only CURRENT r312856M.

Thank you!=20

Alex Deiter
alex.deiter@gmail.com






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F18D421C-6E3F-4A65-AF18-708B9DAEFFBD>