From owner-freebsd-net Fri Jan 11 11:37:27 2002 Delivered-To: freebsd-net@freebsd.org Received: from mail.wrs.com (unknown-1-11.windriver.com [147.11.1.11]) by hub.freebsd.org (Postfix) with ESMTP id A76FD37B404 for ; Fri, 11 Jan 2002 11:37:17 -0800 (PST) Received: from ala-tombila.wrs.com (tombila [147.11.38.16]) by mail.wrs.com (8.9.3/8.9.1) with ESMTP id LAA13967 for ; Fri, 11 Jan 2002 11:36:06 -0800 (PST) Message-Id: <5.1.0.14.2.20020111113634.02dcaa60@wrs.com> X-Sender: anandn@wrs.com X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Fri, 11 Jan 2002 11:39:21 -0800 To: freebsd-net@freebsd.org From: Anand Narayanan Subject: Issue regarding SO_REUSEPORT and SO_REUSEADDR Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hi, I am resending this on the mailing list. This is an issue from in_pcb.c v 1.59.2.5 2000/08/16 06:14:23 I just encountered a problem in trying to bind a server address using the SO_REUSEPORT and SO_REUSEADDR option after the first one has been shutdown. Looking into in_pcbbind, I see that if SO_REUSEADDR or SO_REUSEPORT is set, then the variable "wild" is 0. if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0) wild = 1; However, when calling in_pcblookup_local (in the non-multicast case), it seems to ignore the value of wild. if (lport) { ... ... if (so->so_cred->cr_uid != 0 && !IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) { t = in_pcblookup_local(inp->inp_pcbinfo, sin->sin_addr, lport, prison ? 0 : INPLOOKUP_WILDCARD); Shouldn't the last argument to in_pcblookup_local be "wild" instead of INPLOOKUP_WILDCARD? By passing INPLOOKUP_WILDCARD, in_pcblookup_local always ignores the SO_REUSE* options and bind fails. Is this a bug or am I missing something? Any help would be appreciated. -Anand ******************************** Anand Narayanan Wind River Systems. http://www.windriver.com ******************************** To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message