From owner-freebsd-net Mon Feb 12 19:48:27 2001 Delivered-To: freebsd-net@freebsd.org Received: from starfruit.itojun.org (kame202.kame.net [203.178.141.202]) by hub.freebsd.org (Postfix) with ESMTP id 6605537B491 for ; Mon, 12 Feb 2001 19:48:23 -0800 (PST) Received: from itojun.org (localhost [127.0.0.1]) by starfruit.itojun.org (Postfix) with ESMTP id 8881A7E2A; Tue, 13 Feb 2001 12:48:20 +0900 (JST) To: Archie Cobbs Cc: jlemon@flugsvamp.com, kris@obsecurity.org, net@freebsd.org In-reply-to: archie's message of Mon, 12 Feb 2001 18:31:33 PST. <200102130231.SAA72979@curve.dellroad.org> X-Template-Reply-To: itojun@itojun.org X-Template-Return-Receipt-To: itojun@itojun.org X-PGP-Fingerprint: F8 24 B4 2C 8C 98 57 FD 90 5F B4 60 79 54 16 E2 Subject: Re: [itojun@iijlab.net: accept(2) behavior with tcp RST right after handshake] From: Jun-ichiro itojun Hagino Date: Tue, 13 Feb 2001 12:48:20 +0900 Message-Id: <20010213034820.8881A7E2A@starfruit.itojun.org> Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >> 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 has this been the "current behavior" ? >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. No, i guess your memory is wrong (or remember something different). Before sys/kern/uipc_socket.c 1.52, 4.4BSD-based systems hanged up when: - TCP handshake is done - RST is issued before accept(2) after 1.52 to current, zero-length sockaddr is returned. none of these are correct. >> new behavior: return ECONNABORTED. >> SUSv2 suggests this behavior. it is much safer as accept(2) will fail >> so almost every application will go to error case (if you don't have >> error check in userland appication, that's problem in application). >Why does SUSv2 suggest this when so many applications would break? >And they work fine doing the old behavior (returning a real sockaddr)? again, *BSD never worked right (in terms of SUSv2 definition of "right"). see Stevens "unix network programming" section I mentioned earlier in this thread. itojun To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message