[Dnsmasq-discuss] Domain not applied correctly when reading DHCP lease file

Simon Kelley simon at thekelleys.org.uk
Sun Dec 3 18:18:33 UTC 2023


You're pretty much correct. the code that reads the leases file runs 
(for good reasons) before the code which looks at the addresses of the 
local interfaces, so domain configs which are predicated on the 
interface come out wrong.

thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=commit;h=f1beb79429338d35d3b7f821ea33053ab980ccf5

reorders things and should fix this.


Cheers,

Simon.


On 24/11/2023 01:34, xeyrion at gmail.com wrote:
> I have the following config:
> 
> dhcp-fqdn
> domain=example.com
> domain=eth1.example.com,eth1
> dhcp-range=10.0.1.100,10.0.1.200
> 
> eth1 is 10.0.1.1/24.
> 
> When a client, e.g. host1, makes a DHCP request on eth1, it is
> correctly assigned host1.eth1.example.com as its FQDN. Lease file is
> written correctly, and DNS resolution works as expected.
> 
> However, after dnsmasq is restarted, IP assignment is read correctly
> from the lease file, but FQDN now becomes host1.example.com, which is
> obviously wrong. The original host1.eth1.example.com FQDN does not
> resolve anymore. The problem persists until the client renews its DHCP
> lease.
> 
> If I use address range in config file instead of interface name
> ("domain=eth1.example.com,10.0.1.0/24"), the problem does not occur.
> FQDN is preserved correctly on restart.
> 
> Doing some cursory debugging, the problem appears to be here:
> https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=blob;f=src/domain.c;h=ca3931de13d74db0efdaf4f49a0d0187026d602b;hb=HEAD#l236
> . "c->al" is empty at the time lease file is being read, so no domains
> match, and default domain gets incorrectly assigned.
> 
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
> 



More information about the Dnsmasq-discuss mailing list