svn commit: r316874 - head/sys/kern
Maxim Sobolev
sobomax at sippysoft.com
Fri Apr 14 21:10:58 UTC 2017
Peter, Ngie,
Looks like out of that refactoring came a logical bug that is present in
the head, which causes syslod to first to shutdown the socket for reading
and then try to select/recv on it (which is somewhat stupid). And that
issue has been masked by shutdown() on datagram socket becoming effectively
a NOP in 11 & head 20 months ago. It only affects head though, 11-stable
still has the old code which does not include that half-closed socket into
the select list. Attached patch is expected to fix head, Peter, it would be
nice if you can give it a try (restoring latest changes into
uipc_sockets.c) and let me know if it helps.
Thanks!
On Fri, Apr 14, 2017 at 12:48 PM, Ngie Cooper (yaneurabeya) <
yaneurabeya at gmail.com> wrote:
>
> > On Apr 14, 2017, at 12:46, Peter Wemm <peter at wemm.org> wrote:
> >
> > On Friday, April 14, 2017 12:41:52 PM Maxim Sobolev wrote:
> >> Thanks, Peter. I will try to look into this asap.
> >
> > I don't understand what is going on yet. Presumably there must be other
> > changes in play that affect udp/select sometime between the original 2015
> > change and this. The syslogd -s code is Old(TM). I'm also wondering
> whether
> > the -s code even works at all since the 2015 / r285910 change...
>
> syslogd has been refactored a lot on ^/head. I don’t think it’s safe to
> say that the ^/head and ^/stable/11 and earlier copies will function the
> same.
> Thanks,
> -Ngie
>
--
Maksym Sobolyev
Sippy Software, Inc.
Internet Telephony (VoIP) Experts
Tel (Canada): +1-778-783-0474
Tel (Toll-Free): +1-855-747-7779
Fax: +1-866-857-6942
Web: http://www.sippysoft.com
MSN: sales at sippysoft.com
Skype: SippySoft
-------------- next part --------------
Index: syslogd.c
===================================================================
--- syslogd.c (revision 316854)
+++ syslogd.c (working copy)
@@ -702,7 +702,7 @@
sizeof(fd_mask));
STAILQ_FOREACH(sl, &shead, next) {
- if (sl->sl_socket != -1)
+ if (sl->sl_socket != -1 && sl->sl_recv != NULL)
FD_SET(sl->sl_socket, fdsr);
}
i = select(fdsrmax + 1, fdsr, NULL, NULL,
@@ -2877,6 +2877,7 @@
struct addrinfo hints, *res, *res0;
int error;
char *cp;
+ int (*sl_recv)(struct socklist *);
/*
* We have to handle this case for backwards compatibility:
* If there are two (or more) colons but no '[' and ']',
@@ -3003,6 +3004,7 @@
}
dprintf("new socket fd is %d\n", s);
listen(s, 5);
+ sl_recv = socklist_recv_sock;
dprintf("shutdown\n");
if (SecureMode || res->ai_family == AF_LOCAL) {
/* Forbid communication in secure mode. */
@@ -3013,6 +3015,7 @@
die(0);
}
dprintf("listening on socket\n");
+ sl_recv = NULL;
} else
dprintf("sending on socket\n");
addsock(res->ai_addr, res->ai_addrlen,
@@ -3019,7 +3022,7 @@
&(struct socklist){
.sl_socket = s,
.sl_peer = pe,
- .sl_recv = socklist_recv_sock
+ .sl_recv = sl_recv
});
}
freeaddrinfo(res0);
More information about the svn-src-all
mailing list