SO_REUSEADDR should not also mean SO_REUSEPORT

Arne H. Juul arnej at pvv.ntnu.no
Thu Feb 23 08:44:09 PST 2006


On Tue, 21 Feb 2006, Kurt Miller wrote:
> Thanks for the explanation and also to Nate for the Multicast
> history. I've looked into this a bit more over the weekend and
> found that the network stack promotes SO_REUSEADDR to include
> SO_REUSEPORT for multicast addresses, so I believe that case is
> covered already. I ran the network jck's on the 1.5 jvm with your
> patch and found that SO_REUSEPORT is still needed to pass the jck's
> but for datagram sockets only.

I guess we have to emulate Solaris to pass these, even if I think
the Solaris behaviour is a bit bad.

> Could you try this patch and test it with the program you referred
> to above?

I'll see if I can try this tomorrow; it *should* work for the applications
I'm worried about since those are all using TCP sockets only.  Please
update the comment to say why the "bug-compatibility" is there.

Something like:

  /*
   * On Solaris, SO_REUSEADDR will allow multiple datagram
   * sockets to bind to the same port.  The network jck tests
   * for this "feature", so we need to emulate it by turning on
   * SO_REUSEPORT as well for that combination.
   */

  -  Arne H. J.


More information about the freebsd-java mailing list