Date: Thu, 16 Feb 2006 22:44:15 +0100 From: Arne Juul <Arne.Juul@europe.yahoo-inc.com> To: freebsd-java@freebsd.org Subject: SO_REUSEADDR should not also mean SO_REUSEPORT Message-ID: <43F4F22F.1060402@europe.yahoo-inc.com>
next in thread | raw e-mail | index | archive | help
Description by Håvard Pettersen (Havard.Pettersen@europe.yahoo-inc.com) > Ticket Opened: 2006-02-02 13:37 PST > > In the FreeBSD Java port, setting the reuse_address feature on a > server socket also sets the reuse_port feature, which is not a good > thing, since it allows multiple server sockets to bind to the same > local port. > > A possible work-around is to also disable reuse_address, but this > will disallow listening to an unused local port if a connection > established against that port is still active, which is not good > either. I don't know why this code was put into the bsd jdk patches, it just seems plain wrong to me. It makes java subtly non-portable in a very strange manner; I suggest this code is removed. Below is the patch I'm currently using :-) --- ../../j2se/src/solaris/native/java/net/net_util_md.c.orig Thu Feb 16 20:24:41 2006 +++ ../../j2se/src/solaris/native/java/net/net_util_md.c Thu Feb 16 20:23:24 2006 @@ -1019,17 +1019,20 @@ *bufsize = maxsockbuf; } } } +#if 0 +this is just plain wrong! /* * If SO_REUSEADDR option requested, unconditionally set SO_REUSEPORT. */ if (level == SOL_SOCKET && opt == SO_REUSEADDR) { addopt = SO_REUSEPORT; setsockopt(fd, level, addopt, arg, len); } +#endif /* * Don't allow SO_LINGER value to be too big. * Current max value (240) is empiric value based on tcp_timer.h's * constant TCP_LINGERTIME, which was doubled. - Arne H. J.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43F4F22F.1060402>