Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Jan 2002 11:39:21 -0800
From:      Anand Narayanan <anandn@windriver.com>
To:        freebsd-net@freebsd.org
Subject:   Issue regarding SO_REUSEPORT and SO_REUSEADDR
Message-ID:  <5.1.0.14.2.20020111113634.02dcaa60@wrs.com>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5.1.0.14.2.20020111113634.02dcaa60>