Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding SO_REUSEPORT to Unix lib #3512

Closed
vicuna opened this issue Mar 4, 2005 · 7 comments · Fixed by #9869
Closed

Adding SO_REUSEPORT to Unix lib #3512

vicuna opened this issue Mar 4, 2005 · 7 comments · Fixed by #9869

Comments

@vicuna
Copy link

vicuna commented Mar 4, 2005

Original bug ID: 3512
Reporter: administrator
Status: acknowledged
Resolution: open
Priority: normal
Severity: feature
Category: otherlibs

Bug description

Full_Name: Alon Kama
Version: 3.08-2
OS: OS X (darwin)
Submission from: 85-64-152-87.barak.net.il (85.64.152.87)

On 4.4BSD, In order to use IP Multicasting, the SO_REUSEPORT must be given as a
parameter to setsockopt. On other Unixes and Linux, SO_REUSEADDR is good
enough.

Ocaml 3.08 supports calling SO_REUSEADDR but not SO_REUSEPORT. I've manually
changed the code and added this option, and have verified that it works as
necessary. I'm requesting to add this option to the next release.

Thanks.

@vicuna
Copy link
Author

vicuna commented Mar 8, 2005

Comment author: administrator

On 4.4BSD, In order to use IP Multicasting, the SO_REUSEPORT must be
given as a parameter to setsockopt. On other Unixes and Linux,
SO_REUSEADDR is good enough. Ocaml 3.08 supports calling
SO_REUSEADDR but not SO_REUSEPORT.

Well, SO_REUSEPORT is a BSD-ism that isn't present everywhere. It is
not in the Single Unix Specification, in particular, and that's the
spec we try to stick to in the OCaml Unix library.

Also, http://www.unixguide.net/network/socketfaq/4.11.shtml quotes
Richard Stevens (someone I tend to listen to) as writing:

But when binding a multicast address (its main use), SO_REUSEADDR is
considered identical to SO_REUSEPORT (p. 731, "TCP/IP Illustrated,
Volume 2"). So for portability of multicasting applications I always
use SO_REUSEADDR.

So, there might be something non-standard in MacOS X about this.

Regards,

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Mar 8, 2005

Comment author: administrator

BSDism, not standard enough? XL, 2005-03-08

@vicuna
Copy link
Author

vicuna commented Mar 9, 2005

Comment author: administrator

Hello Xavier, thanks for the response.

You're right that it is a BSDism, though I don't believe that Darwin
has any plans to change this. Thus, IP multicast with OCaml is broken
for that platform. I have seen that Ruby and Perl have added this
socket option, as have I for my source-compiled OCaml build. Can you
think of an alternative way to set this option without explicitly
including it in the socket option list?

Thanks,

-Alon.

On Mar 8, 2005, at 12:40, Xavier Leroy wrote:

On 4.4BSD, In order to use IP Multicasting, the SO_REUSEPORT must be
given as a parameter to setsockopt. On other Unixes and Linux,
SO_REUSEADDR is good enough. Ocaml 3.08 supports calling
SO_REUSEADDR but not SO_REUSEPORT.

Well, SO_REUSEPORT is a BSD-ism that isn't present everywhere. It is
not in the Single Unix Specification, in particular, and that's the
spec we try to stick to in the OCaml Unix library.

Also, http://www.unixguide.net/network/socketfaq/4.11.shtml quotes
Richard Stevens (someone I tend to listen to) as writing:

But when binding a multicast address (its main use), SO_REUSEADDR is
considered identical to SO_REUSEPORT (p. 731, "TCP/IP Illustrated,
Volume 2"). So for portability of multicasting applications I always
use SO_REUSEADDR.

So, there might be something non-standard in MacOS X about this.

Regards,

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Dec 6, 2016

Comment author: @mshinwell

It sounds like SO_REUSEPORT has become more widespread now (2016) so we might consider adding this.

@vicuna
Copy link
Author

vicuna commented Dec 7, 2016

Comment author: @xavierleroy

Stevens must be spinning in his grave... A pull request on Github implementing this feature would be welcome.

@github-actions
Copy link

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

@github-actions github-actions bot added the Stale label May 18, 2020
@xavierleroy
Copy link
Contributor

I'm willing to admit that SO_REUSEPORT is more widely available now, with slightly different semantics from SO_REUSEADDR (https://lwn.net/Articles/542629/). A pull request, please?

@github-actions github-actions bot closed this as completed Jul 1, 2020
xavierleroy pushed a commit that referenced this issue Sep 2, 2020
Support the SO_REUSEPORT socket option.

Closes: #3512
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants