Hi All

Functions and conditions used in dnsmasq while choosing the entry in hosts file for a MAC address request -

https://github.com/guns/dnsmasq/blob/nerv/src/dhcp-common.c#L275
https://github.com/guns/dnsmasq/blob/nerv/src/dhcp-common.c#L287
https://github.com/guns/dnsmasq/blob/nerv/src/dhcp-common.c#L292
https://github.com/guns/dnsmasq/blob/nerv/src/dhcp-common.c#L328

For example, If I have a host file with below two entries,

fa:16:3e:8f:9d:65,host-30-0-0-5.openstacklocal,30.0.0.5,set:aabc7d33-4874-429e-9637-436e4232d2cd (entry for IPv4)

fa:16:3e:8f:9d:65,set:aabc7d33-4874-429e-9637-436e4232d2cd (entry for stateless IPv6 for v6 options)

dnsmaq reads the hosts file from EOF, and stores the each entry as a config in configs.
When find_config called to resolve ip, in above example hosts file,

 a) It first reads entry for stateless IPv6

b) As no CONFIG_ADDR | CONFIG_ADDR6 flags found for this entry, it returns 1(L275)

c) find_config will return this entry, as both is_config_in_conext and congig_has_mac are true, to resolve ip.

d) As there is no ip in this entry, dnsmaq logs "no address available" and fails to send DHCPOFFER message.

So If we reverse the order of writing entries in host file, so that entry for dnsmasq comes first, then dnsmasq can correctly fetch the IPv4 address.

This was the solution proposed in https://review.openstack.org/#/c/185066/1/neutron/agent/linux/dhcp.py Line 457. Are the findings in this mail( understood behavior for this scenario) are correct?

Thanks
Anil Venkata Kommadi


_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss

Reply via email to