freebsd-dev/lib
John Polstra e2e3d0a401 For the TCP transport, put the listening socket in non-blocking
mode.  This addresses a well-known race condition that can cause
servers to hang in accept().  The relevant case is when somebody
connects to the server and then immediately kills the connection
by sending a TCP reset.  On the server this causes select to report
a ready condition on the socket, after which the accept call blocks
because there is no longer any pending connection to accept.

In -current there is already a work-around for this in the kernel.
It was merged into -stable some time ago, but then David Greenman
reverted it because it seemed to be causing a socket leak in some
cases.  (See uipc_socket.c revision 1.51.2.3.)  Hence this userland
fix is needed in -stable, and I plan to merge it into that branch
soon because it fixes a potential DoS attack.  It may also be needed
in -current if the suspected socket leak turns out to be real.  In
any case, after thinking it over I believe the fix belongs in
userland.  An application shouldn't assume that a ready return from
select guarantees that the subsequent I/O operation cannot block.
A lot can happen between the select and the accept.

A similar fix should most likely be applied to the Unix domain
socket transport too.

Submitted by:	peter
Reviewed by:	jdp
1999-11-18 03:01:06 +00:00
..
compat Add $FreeBSD$ - not that it makes much difference, but this is mainly meant 1999-10-29 01:20:50 +00:00
csu $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
libalias Restore sub-chapters order. 1999-11-09 00:24:09 +00:00
libatm $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
libbind
libc For the TCP transport, put the listening socket in non-blocking 1999-11-18 03:01:06 +00:00
libc_r Add sigsuspend.o and sigpending.o to HIDDEN_SYSCALLS as well. 1999-10-14 10:08:53 +00:00
libcalendar $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
libcam Fix a file descriptor leak in cam_open_btl(). The xpt device was opened, 1999-09-12 19:40:20 +00:00
libcom_err Zap $Source$ 1999-09-06 07:41:34 +00:00
libcompat $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
libcrypt Never return NULL, always return a hash. 1999-09-22 06:53:08 +00:00
libcurses $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
libdevstat Clarify what getdevs() expects as input. 1999-09-23 06:36:02 +00:00
libdisk Teach libdisk about the AMI and Mylex RAID drivers. You should be able 1999-11-02 03:40:14 +00:00
libedit Fix style bugs 1999-10-03 10:41:40 +00:00
libfetch $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
libform Add bmake glue for libform (the SVSV-style ETI curses form driver from 1999-09-05 05:37:49 +00:00
libftpio Fix style bugs and ordering 1999-10-03 10:40:11 +00:00
libgnumalloc $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
libio $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
libipx $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
libkse Add sigsuspend.o and sigpending.o to HIDDEN_SYSCALLS as well. 1999-10-14 10:08:53 +00:00
libkvm Introduce commandline caching in the kernel. 1999-11-16 20:31:58 +00:00
libm ${MACHINE} -> ${MACHINE_ARCH} 1999-11-14 13:54:44 +00:00
libmd $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
libmenu Add bmake glue for libmenu (the SVSV-style ETI curses menu driver from 1999-09-05 05:32:46 +00:00
libmytinfo Fix termcap % code processing for some terminals. 1999-10-20 08:52:09 +00:00
libncp Repo copy ncp_cfg.h ncp_lib.h ncp_file.h ncp_rcfile.h from here to 1999-11-12 15:09:58 +00:00
libncurses Don't complain loudly about unknown termcap capabilities, eg: 1999-11-17 01:01:02 +00:00
libnetgraph Whistle's Netgraph link-layer (sometimes more) networking infrastructure. 1999-10-21 09:06:11 +00:00
libopie $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
libpam Don't include Kerberos if NOCRYPT is defined, because it isn't build 1999-11-14 15:48:29 +00:00
libpanel Add bmake glue for libpanel (the SVSV-style ETI curses panel (overlapping 1999-09-05 05:36:12 +00:00
libpcap $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
libpthread Add sigsuspend.o and sigpending.o to HIDDEN_SYSCALLS as well. 1999-10-14 10:08:53 +00:00
libradius Add support for RADIUS accounting. Note, this changes the format 1999-10-31 04:47:59 +00:00
libresolv Don't build elf libresolv.so*, no elf freebsd binaries have used it ever. 1998-10-11 04:21:56 +00:00
librpcsvc $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
libskey Add $FreeBSD$ lines to man pages that are missing them to make it 1999-08-28 23:10:20 +00:00
libss sigset_t change (part 5 of 5) 1999-09-29 15:18:46 +00:00
libstand Change toupper/tolower so that they don't give a bogus answer if the 1999-09-11 17:54:37 +00:00
libtacplus $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
libtelnet $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
libtermcap Explicitly use sigemptyset to clear a sigset_t. Explicit 1999-09-28 13:43:21 +00:00
libutil Make setproctitle(NULL) restore all of the original arguments 1999-11-17 21:12:17 +00:00
libvgl Fix the VGLBITMAP_INITIALIZER macro; VXsize and VYsize should 1999-11-09 12:11:24 +00:00
libwrap $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
libxpg4 I have added the support for BIG5 encoding into libc/libxpg4/mklocale. 1998-08-15 12:51:49 +00:00
liby $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
libz Hard-configure z_off_t as long. Soft configuration using HAVE_UNISTD_H 1999-10-09 11:31:50 +00:00
msun style fix 1999-11-09 00:18:22 +00:00
ncurses Don't complain loudly about unknown termcap capabilities, eg: 1999-11-17 01:01:02 +00:00
Makefile Whistle's Netgraph link-layer (sometimes more) networking infrastructure. 1999-10-21 09:06:11 +00:00
Makefile.inc