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

Parke parke.nexus at gmail.com
Thu Dec 21 05:45:47 GMT 2017


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



More information about the Dnsmasq-discuss mailing list