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

Add support for FreeBSD's SO_REUSEPORT_LB #9157

Merged
merged 1 commit into from
Aug 21, 2020

Conversation

rgacogne
Copy link
Member

Short description

On FreeBSD, SO_REUSEPORT "permits multiple instances of a program to each receive UDP/IP multicast or broadcast datagrams destined for the bound port", while SO_REUSEPORT_LB distributes them "among the sharing processes based on a hash function of local port number, foreign IP address and port number".

I tested that SO_REUSEPORT is still correctly enabled on Linux after this change, but not that SO_REUSEPORT_LB is actually enabled on FreeBSD.

Closes #9156.

Checklist

I have:

  • read the CONTRIBUTING.md document
  • compiled this code
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)

On FreeBSD, SO_REUSEPORT "permits multiple instances of a program to each
receive UDP/IP multicast or broadcast datagrams destined for the bound port",
while SO_REUSEPORT_LB distributes them "among the sharing processes based on
a hash function of local port number, foreign IP address and port number".
Copy link
Member

@omoerbeek omoerbeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to have a confirmation SO_REUSEPORT_LB is indeed used on FreeBSD

@rgacogne
Copy link
Member Author

rgacogne commented Jun 5, 2020

It would be good to have a confirmation SO_REUSEPORT_LB is indeed used on FreeBSD

Agreed, let's try to get some FreeBSD user interested in testing this :-)

@kbowlingns
Copy link

We left SO_REUSEPORT intact on FreeBSD because it allows staging a software upgrade for instance, where you gradually drain connections from the first image and the second starts to take the new ones. Not sure if it is worth exposing both options to FreeBSD users, most would probably prefer the _LB variant.

@Habbie
Copy link
Member

Habbie commented Aug 20, 2020

@RvdE reports seeing _LB in a trace. He also reports getting duplicate TCP sockets but not duplicate UDP sockets.

@RalfvdEnden
Copy link

Just double checked and it works for udp(4|6) as well. Must have been looking at the TLS port (853) earlier, which I don't set the 'reusePort=true' on (not even sure it's supported).

@rgacogne
Copy link
Member Author

Thanks for checking! Habbie, Otto, any objection to merging this?

@Habbie
Copy link
Member

Habbie commented Aug 20, 2020

do it

@rgacogne rgacogne merged commit ecd367c into PowerDNS:master Aug 21, 2020
@rgacogne rgacogne deleted the reuseport-lb branch August 21, 2020 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support FreeBSD SO_REUSEPORT_LB socket option
5 participants