Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Apr 2017 14:10:56 -0700
From:      Maxim Sobolev <sobomax@sippysoft.com>
To:        "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
Cc:        Peter Wemm <peter@wemm.org>, svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers <src-committers@freebsd.org>, Hiren Panchasara <hiren@freebsd.org>
Subject:   Re: svn commit: r316874 - head/sys/kern
Message-ID:  <CAH7qZfvPQpmTkypWdv1K=9yKF6was1sXuXY7McAeTrC8mvYZbg@mail.gmail.com>
In-Reply-To: <513B1846-02E3-49E0-BAA2-CA923EDC5DFF@gmail.com>
References:  <201704141723.v3EHNS3B043902@repo.freebsd.org> <12133324.zHp9vo75vZ@overcee.wemm.org> <CAH7qZfuxM2pWvPh-LGP8_vrSpm==hTCWjnoZoXSvaFSgAaS8pg@mail.gmail.com> <6942092.OsECkgAp13@overcee.wemm.org> <513B1846-02E3-49E0-BAA2-CA923EDC5DFF@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
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@gmail.com> wrote:

>
> > On Apr 14, 2017, at 12:46, Peter Wemm <peter@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@sippysoft.com
Skype: SippySoft

[-- Attachment #2 --]
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);

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAH7qZfvPQpmTkypWdv1K=9yKF6was1sXuXY7McAeTrC8mvYZbg>