Re: [itojun@iijlab.net: accept(2) behavior with tcp RST right afterhandshake]

2001-03-08 Thread Wietse Venema
Jonathan Graehl: > > > Data CAN be lost if the TCP connection is RST. It has nothing to > > > do with the ordering of accept() with respect to close(). > > > > Please educate me: how would RST come into this discussion at all? > > The client does connect() write() close(), there is no forced > >

Re: [itojun@iijlab.net: accept(2) behavior with tcp RST right afterhandshake]

2001-03-08 Thread Wietse Venema
Jonathan Lemon: > On Thu, Mar 08, 2001 at 10:38:17AM -0500, Wietse Venema wrote: > > If the result of connect() write() close() depends on whether > > accept() happens after or before close(), then the behavior is > > broken. The client has received a successful return from write() > > and close()

Re: [itojun@iijlab.net: accept(2) behavior with tcp RST right afterhandshake]

2001-03-08 Thread Wietse Venema
If the result of connect() write() close() depends on whether accept() happens after or before close(), then the behavior is broken. The client has received a successful return from write() and close(). The system is not supposed to lose the data, period. This race condition did not exist with UN

Re: [itojun@iijlab.net: accept(2) behavior with tcp RST right afterhandshake]

2001-03-07 Thread Wietse Venema
Several parts of Postfix do: connect() write() close(), where the close() may happen before the server has accept()ed the connection. Due to an incompatible change in FreeBSD 4.2-STABLE, this causes accept() after close() to fail. The already written data is lost. This is a bad incompatible chan

Re: [itojun@iijlab.net: accept(2) behavior with tcp RST right afterhandshake]

2001-02-13 Thread Archie Cobbs
Garrett Wollman writes: > > ISTR at one time you would instead get the actual sockaddr of the > > just-closed socket, rather than a bogus sockaddr... and that is the > > behavior one would expect. > > As itojun pointed out, accept() used to just block if the socket it > thought it was going to gi

Re: [itojun@iijlab.net: accept(2) behavior with tcp RST right afterhandshake]

2001-02-13 Thread Garrett Wollman
< said: > ISTR at one time you would instead get the actual sockaddr of the > just-closed socket, rather than a bogus sockaddr... and that is the > behavior one would expect. As itojun pointed out, accept() used to just block if the socket it thought it was going to give you turned out not to be

Re: [itojun@iijlab.net: accept(2) behavior with tcp RST right afterhandshake]

2001-02-12 Thread Archie Cobbs
Jonathan Lemon writes: > It seems to me that the odds of an application being able to correctly > handle an error return from accept() are far greater than the odds that > the code correctly checks 'len' upon return from accept. This, combined > with the standard, seems to be rationale enough to

Re: [itojun@iijlab.net: accept(2) behavior with tcp RST right afterhandshake]

2001-02-12 Thread Archie Cobbs
[EMAIL PROTECTED] writes: > >And what do you mean by ``most apps already do the wrong thing now''? > > for background (like when this happens) see previous articles > on this thread. > > current behavior: return 0-length sockaddr. Yeah, that is totally broken. Hmm.. how long

Re: [itojun@iijlab.net: accept(2) behavior with tcp RST right afterhandshake]

2001-02-12 Thread Archie Cobbs
Jonathan Lemon writes: > > > Did you guys agree on a commit-worthy fix yet? > > > > I wasn't party to the issue that generated this thread in the first > > place, but.. I think the concensus is that if accept(2) returns > > an error then this will break some applications, so instead it > > shoul

Re: [itojun@iijlab.net: accept(2) behavior with tcp RST right afterhandshake]

2001-02-12 Thread Archie Cobbs
Kris Kennaway writes: > Did you guys agree on a commit-worthy fix yet? I wasn't party to the issue that generated this thread in the first place, but.. I think the concensus is that if accept(2) returns an error then this will break some applications, so instead it should return a socket which w

Re: [itojun@iijlab.net: accept(2) behavior with tcp RST right afterhandshake]

2001-02-11 Thread Kris Kennaway
Did you guys agree on a commit-worthy fix yet? Kris PGP signature

Re: [itojun@iijlab.net: accept(2) behavior with tcp RST right afterhandshake]

2001-02-08 Thread Archie Cobbs
Jonathan Lemon writes: > >> Jayanth did make one point that an application could assume that > >> the error return from accept was in regards to the listening socket > >> instead of the new socket, so that may be a concern. > > > >Yes I have always assumed this to be true. If the connection is >

Re: [itojun@iijlab.net: accept(2) behavior with tcp RST right afterhandshake]

2001-02-08 Thread Archie Cobbs
Robert Watson writes: > > Jonathan Lemon writes: > > > Jayanth did make one point that an application could assume that > > > the error return from accept was in regards to the listening socket > > > instead of the new socket, so that may be a concern. > > > > Yes I have always assumed this to b

Re: [itojun@iijlab.net: accept(2) behavior with tcp RST right afterhandshake]

2001-02-08 Thread Jonathan Lemon
In article [EMAIL PROTECTED]> you write: >Jonathan Lemon writes: >> Jayanth did make one point that an application could assume that >> the error return from accept was in regards to the listening socket >> instead of the new socket, so that may be a concern. > >Yes I have always assumed this to

Re: [itojun@iijlab.net: accept(2) behavior with tcp RST right afterhandshake]

2001-02-07 Thread Archie Cobbs
Jonathan Lemon writes: > Jayanth did make one point that an application could assume that > the error return from accept was in regards to the listening socket > instead of the new socket, so that may be a concern. Yes I have always assumed this to be true. If the connection is already broken be

Re: [itojun@iijlab.net: accept(2) behavior with tcp RST right afterhandshake]

2001-02-07 Thread Jonathan Lemon
In article [EMAIL PROTECTED]> you write: >-=-=-=-=-=- > >Can anyone comment on this patch? > >http://www.kame.net/dev/cvsweb.cgi/kame/freebsd4/sys/kern/uipc_socket.c Looks good to me (although the patch is mixed in with a bunch of other crud). I've tested it out locally and will commit it unless

[itojun@iijlab.net: accept(2) behavior with tcp RST right afterhandshake]

2001-02-07 Thread Garrett Wollman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 < said: > Can anyone comment on this patch? > http://www.kame.net/dev/cvsweb.cgi/kame/freebsd4/sys/kern/uipc_socket.c I don't necessarily agree that the previous behavior was wrong, but I'm willing to bet that a lot of programs don't bother to chec

[itojun@iijlab.net: accept(2) behavior with tcp RST right afterhandshake]

2001-02-07 Thread Kris Kennaway
Can anyone comment on this patch? http://www.kame.net/dev/cvsweb.cgi/kame/freebsd4/sys/kern/uipc_socket.c Kris - Forwarded message from [EMAIL PROTECTED] - Delivered-To: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: accept(2) behavior with tcp RST rig