<div dir="ltr">FYI a good overview of SO_REUSEPORT at least in Linux is here<div><a href="https://blog.cloudflare.com/the-sad-state-of-linux-socket-balancing/">https://blog.cloudflare.com/the-sad-state-of-linux-socket-balancing/</a><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 21, 2017 at 5:45 AM, Parke <span dir="ltr"><<a href="mailto:parke.nexus@gmail.com" target="_blank">parke.nexus@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, Dec 20, 2017 at 9:18 PM, Parke <<a href="mailto:parke.nexus@gmail.com">parke.nexus@gmail.com</a>> wrote:<br>
> And there is the big question of: Will each incoming UDP packet be<br>
> sent to all receiving sockets?  Or just to one out of a pool of<br>
> receiving sockets?<br>
<br>
</span>Looks like load balancing to me.<br>
<br>
>From man 7 socket on Linux:<br>
<br>
       SO_REUSEPORT (since Linux 3.9)<br>
<br>
              For UDP sockets, the use of this option  can<br>
              provide   better  distribution  of  incoming<br>
              datagrams to multiple processes (or threads)<br>
              as  compared to the traditional technique of<br>
              having multiple processes compete to receive<br>
              datagrams on the same socket.<br>
<br>
Perhaps dnsmasq is hoping that each separate instance is bound to a<br>
different device/interface via SO_BINDTODEVICE?  (Of course, dnsmasq<br>
lacks the ability to confirm that other instances are correctly<br>
configured.)<br>
<br>
And that device binding will give each incoming packet only a single<br>
path to the single (and correct) instance of dnsmasq?<br>
<br>
And the SO_REUSEADDR option is necessary to allow multiple bindings to<br>
the same address (even though each binding is to a separate interface<br>
via SO_BINDTODEVICE)?<br>
<br>
And given that FreeBSD lacks SO_BINDTODEVICE, this code will not work<br>
as intended on FreeBSD?  (I.e. FreeBSD will get undesired load<br>
balancing, rather than mirroring which would work?)<br>
<br>
But it seems that all the above can be done with just SO_REUSEADDR,<br>
and that SO_REUSEPORT is superfluous.  At least on Linux.  (As the<br>
purpose of SO_REUSEPORT is to load balance across processes while<br>
bypassing expensive inter-process contention for a single socket?)<br>
Hmmm.  Hopefully someone who understands it can decide if I am making<br>
any sense.<br>
<div class="HOEnZb"><div class="h5"><br>
-Parke<br>
<br>
______________________________<wbr>_________________<br>
Dnsmasq-discuss mailing list<br>
<a href="mailto:Dnsmasq-discuss@lists.thekelleys.org.uk">Dnsmasq-discuss@lists.<wbr>thekelleys.org.uk</a><br>
<a href="http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss" rel="noreferrer" target="_blank">http://lists.thekelleys.org.<wbr>uk/mailman/listinfo/dnsmasq-<wbr>discuss</a><br>
</div></div></blockquote></div><br></div>