[Dnsmasq-discuss] DHCP lease hostname with multiple hosts of the same name
simon at thekelleys.org.uk
Fri Jul 2 16:18:29 UTC 2021
On 02/07/2021 15:42, Petr Menšík wrote:
> current dnsmasq has a bug  in handling hostname setting. When two
> hosts request equal hostname, dnsmasq will reset name in previous lease
> and change registered name to the most recent requestor adddress.
> It does not work well with lease-script used by libvirt, because when
> lease name is reset, such change is not propagated to script. It changes
> only when dnsmasq is restarted. It does not load leases the same way,
> only one of leases would contain name.
> I have attached simple fix to propagate change to lease script. It would
> make lease handler report correct state and it works nice with libvirt.
> I am not sure current algorithm is the best one for leases reservation.
> Replacement of previous lease hostname works even without restart after
> attached change.
> 1. https://bugzilla.redhat.com/show_bug.cgi?id=1910621
Patch applied, that's clearly the correct thing to do, thanks.
As to why the handling of names is the way it is, it's been a very long
time since that was designed, but it was designed. It takes into account
that the most likely case is that a host gets unplugged from a network
and plugged into a new one. (or changes SSID), or changes from a wired
to a wireless network (and hence changes MAC address). The most sensible
thing to do in that case is to assume that the old lease is defunct (at
least as far as naming is concerned, the address reservation persists)
and give the name to the new one.
It's not secure, but assigning DNS names based information supplied by
DHCP is inherently insecure anyway. We do take care to honour explicit
assignment of names to MAC addresses or client-ids in the dnsmasq
configuration, so that random hosts can't hijack names in that case.
More information about the Dnsmasq-discuss