From owner-freebsd-bugs Tue May 16 11:59:06 1995 Return-Path: bugs-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id LAA17276 for bugs-outgoing; Tue, 16 May 1995 11:59:06 -0700 Received: from cmc.eng.comsat.com (cmc.eng.comsat.com [134.133.169.1]) by freefall.cdrom.com (8.6.10/8.6.6) with SMTP id LAA17266 for ; Tue, 16 May 1995 11:59:00 -0700 Received: from cmc (cmc.eng.comsat.com) by cmc.eng.comsat.com (4.1/SMI-4.1) id AA04757; Tue, 16 May 95 14:56:49 EDT Date: Tue, 16 May 1995 14:56:18 -0400 (EDT) From: MARC Giannoni Subject: Binding a socket (fwd) To: bugs@FreeBSD.org Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: bugs-owner@FreeBSD.org Precedence: bulk ---------- Forwarded message ---------- Date: Tue, 4 Apr 1995 13:44:43 -0400 (EDT) From: KEITH Regan To: FreeBSD-questions@freefall.cdrom.com Cc: marc@cmc.eng.comsat.com Subject: Binding a socket Hey - I'm having some problems with my unpatched FreeBSD 2.0 Walnut Creek CDROM. I'm am trying to bind a socket to a specific port (> 1024) with address INADDR_ANY using the TCP protocol in the Inet domain with the REUSEADDR and REUSEPORT options enabled and I get the EADDRINUSE error. I looked at what I believe to be the netinet source code for "bind" processing (in_pcb.c) and it is unclear why in in_pcbbind near: return (error); t = in_pcblookup(head, zeroin_addr, 0, sin->sin_addr, lport, wild); if (t && (reuseport & t->inp_socket->so_options) == 0) return (EADDRINUSE); there is this check against the option settings of the in_pcblookup results. It would seem that, if reuseport is ever true (and in my case it is (I think)), then any "sin" address will always be declared in use even if it has never been in use. I have verified this. With REUSEADDR and REUSEPORT not enabled, the bind works. With them enabled, it does not. I've tried just using REUSEADDR, and while I can get the bind to work, any subsequent attempt at "reusing" the port results in the same error. Whatdayathink? Do I have it all wrong? It there some clever work around or patch that I can use to move on? Thanx in advance. --- keith@cmc.eng.comsat.com --- /~~~~~\ /~~~~\ /~\ /~\ |~~~~\ /~~\ |~~~~~~~| Keith G. Regan | |---/ | /~~\ | | \/ | | +-| / /\ \ |--| |--| Director | | | | | | | \ / | \ \ | [<>] | | | Software Engineering | |---\ | \__/ | | |\/| | |-+ | | | | | | | Comsat Mobile Comm. \_____/ \____/ |_| |_| \____/ |_| |_| |_| 22300 Comsat Drive Clarksburg, MD 78720 Tel: (301) 428-2348 M O B I L E C O M M U N I C A T I O N S Fax: (301) 601-5959