From owner-freebsd-net Wed Mar 7 12:16:22 2001 Delivered-To: freebsd-net@freebsd.org Received: from prism.flugsvamp.com (cb58709-a.mdsn1.wi.home.com [24.17.241.9]) by hub.freebsd.org (Postfix) with ESMTP id C677E37B718 for ; Wed, 7 Mar 2001 12:16:14 -0800 (PST) (envelope-from jlemon@flugsvamp.com) Received: (from jlemon@localhost) by prism.flugsvamp.com (8.11.0/8.11.0) id f27KDoS39501; Wed, 7 Mar 2001 14:13:50 -0600 (CST) (envelope-from jlemon) Date: Wed, 7 Mar 2001 14:13:50 -0600 (CST) From: Jonathan Lemon Message-Id: <200103072013.f27KDoS39501@prism.flugsvamp.com> To: Arjan.deVet@adv.iae.nl, net@freebsd.org, wietse@porcupine.org, postfix-users@postfix.org Subject: Re: [itojun@iijlab.net: accept(2) behavior with tcp RST right after handshake] X-Newsgroups: local.mail.freebsd-net In-Reply-To: References: Organization: Cc: Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org In article you write: >In article > Robert >Watson wrote: > >>It seems that the ECONNABORTED is the "standard" way to address this >>scenario; it might be an interesting exercise for someone to look at the >>common application suites and see how they respond to various failure >>modes in accept(). It certainly appears that BIND9 expects that. > >FYI, Postfix seems to have problems with the ECONNABORTED part of the >change, see the mail below from postfix-users. > >Arjan > >-- >Arjan de Vet, Eindhoven, The Netherlands >URL: http://www.iae.nl/users/devet/ for PGP key: finger devet@iae.nl > >Subject: Re: errors from flush [again] >In-Reply-To: <20010306234957.EE524BC06D@spike.porcupine.org> "from >Wietse Venema at Mar 6, 2001 06:49:57 pm" >To: Wietse Venema >Date: Wed, 7 Mar 2001 10:26:22 -0500 (EST) >Cc: Arjan de Vet , postfix-users@postfix.org >Message-ID: <20010307152622.01B61BC070@spike.porcupine.org> >From: wietse@porcupine.org (Wietse Venema) > >Postfix 20010228 is OK on FreeBSD 4.2-RELEASE. > >I just checked that the system behaves sanely when Postfix does > > connect() > write() > close() > >before the server has accept()ed the connection. > >Reportedly, some later FreeBSD versions introduce a race condition >here. If the server accept()s the connection before the client >close()s it, then the server may receive the data. If the server >accept()s the connection after the client close()s it, the data is >lost. In both cases, the client is told that the data was transmitted >without error. Actually, this is incorrect. The server in both cases will correctly receive the data from the client; it does not matter if the client has (correctly) closed the socket before the server gets around to accepting it. This case only applies to when connection is reset after the initial handshake, but before the connection is accepted. All we are doing is returning an error immediately via accept(), instead of waiting for a subsequent operation on the socket to fail. There is no change to the read/write semantics here; the local TCP endpoint (and any buffers) have already been destroyed. I probably poorly worded the commit message; it should read "return ECONNABORTED if connection receives a RST while on the listen queue". Under normal operation, the client's connection isn't really closed until it receives a FIN/ACK from the server. -- Jonathan To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message