[Dnsmasq-discuss] DHCP hosts without active leaes not added to DNS cache

Dominik Derigs dl6er at dl6er.de
Tue Feb 23 09:13:06 UTC 2021


Hey list,

When specifying a DHCP host like

--dhcp-host=00:20:e0:3b:13:af,192.168.0.2,wap

I'd expect dnsmasq to respond to `dig wap` with the IP address
`192.168.0.2`. Instead, NOERROR with empty answer RR is returned.

Looking at the source code, this is expected as `lease_update_dns()`
loops over `struct dhcp_lease *leases` which do not contain the devices
configures by `--dhcp-host`. These are stored in `daemon->dhcp_conf`
and iterated over only when devices request a lease.

If the device now requests a lease, `wap` is added to `*leases` and the
leases database file from where it is also read from there on
subsequent restarts (the `--dhcp-host` isn't needed anymore).

My `dig wap` now works as expected as `wap` is in `*leases`.

My question: Is not adding --dhcp-host hosts to the DNS cache a bug or
is this somehow intended behavior?

Best regards,
Dominik




More information about the Dnsmasq-discuss mailing list