[Dnsmasq-discuss] Is dnsmasq supposed to listen on UDP port 0.0.0.0:67 when listen-address is specified?

Ignat Korchagin ignat at cloudflare.com
Thu Dec 21 10:56:35 GMT 2017


FYI a good overview of SO_REUSEPORT at least in Linux is here
https://blog.cloudflare.com/the-sad-state-of-linux-socket-balancing/

On Thu, Dec 21, 2017 at 5:45 AM, Parke <parke.nexus at gmail.com> wrote:

> On Wed, Dec 20, 2017 at 9:18 PM, Parke <parke.nexus at gmail.com> wrote:
> > And there is the big question of: Will each incoming UDP packet be
> > sent to all receiving sockets?  Or just to one out of a pool of
> > receiving sockets?
>
> Looks like load balancing to me.
>
> From man 7 socket on Linux:
>
>        SO_REUSEPORT (since Linux 3.9)
>
>               For UDP sockets, the use of this option  can
>               provide   better  distribution  of  incoming
>               datagrams to multiple processes (or threads)
>               as  compared to the traditional technique of
>               having multiple processes compete to receive
>               datagrams on the same socket.
>
> Perhaps dnsmasq is hoping that each separate instance is bound to a
> different device/interface via SO_BINDTODEVICE?  (Of course, dnsmasq
> lacks the ability to confirm that other instances are correctly
> configured.)
>
> And that device binding will give each incoming packet only a single
> path to the single (and correct) instance of dnsmasq?
>
> And the SO_REUSEADDR option is necessary to allow multiple bindings to
> the same address (even though each binding is to a separate interface
> via SO_BINDTODEVICE)?
>
> And given that FreeBSD lacks SO_BINDTODEVICE, this code will not work
> as intended on FreeBSD?  (I.e. FreeBSD will get undesired load
> balancing, rather than mirroring which would work?)
>
> But it seems that all the above can be done with just SO_REUSEADDR,
> and that SO_REUSEPORT is superfluous.  At least on Linux.  (As the
> purpose of SO_REUSEPORT is to load balance across processes while
> bypassing expensive inter-process contention for a single socket?)
> Hmmm.  Hopefully someone who understands it can decide if I am making
> any sense.
>
> -Parke
>
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20171221/704359fe/attachment.html>


More information about the Dnsmasq-discuss mailing list