From owner-freebsd-hackers Thu Dec 14 9:41: 3 2000 From owner-freebsd-hackers@FreeBSD.ORG Thu Dec 14 09:41:02 2000 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id 3582037B400 for ; Thu, 14 Dec 2000 09:41:01 -0800 (PST) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id eBEHewj06419; Thu, 14 Dec 2000 09:40:58 -0800 (PST) Date: Thu, 14 Dec 2000 09:40:58 -0800 From: Alfred Perlstein To: =?iso-8859-1?Q?Mikko_Ty=F6l=E4j=E4rvi?= Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Rejecting a connection: is accept(2) correct? Message-ID: <20001214094058.C4589@fw.wintelcom.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.2.5i In-Reply-To: ; from mikko@dynas.se on Thu, Dec 14, 2000 at 09:12:18AM -0800 Sender: bright@fw.wintelcom.net Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Mikko Työläjärvi [001214 09:12] wrote: > > AFAIK there is no portable way to reject incoming connections without > calling accept(). However, accept(2) states: > > One can obtain user connection request data without confirming > the connection by issuing a recvmsg(2) call with an msg_iovlen of > 0 and a non-zero msg_controllen, or by issuing a getsockopt(2) > request. Similarly, one can provide user connection rejection > information by issuing a sendmsg(2) call providing only the > control information, or by calling setsockopt(2). > > Is this really true? A quick experiment with recvmsg() seems to > indicate it is not, at least not for TCP sockets. It's supposed to be used with the OSI protocols or something. :) Adapting it to TCP would be nice, but the problem in FreeBSD at least is that by the time a socket is in the listen queue is has completed the TCP connection handshake. > P.S. Anybody who claims that this works is encouraged to provide > proof in the form of code... :-) hah. -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] "I have the heart of a child; I keep it in a jar on my desk." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message