[Dnsmasq-discuss] dnsmasq: dhcp-server with disabled dns-server: /etc/hosts ignored
Matus UHLAR - fantomas
uhlar at fantomas.sk
Sun Oct 23 11:46:13 UTC 2022
>On Fri, Oct 21, 2022 at 11:23:28PM +0200, Michael Traxler wrote:
>> dnsmasq-2.87:
>> When you disable the DNS-server via
>> port=0
>>
>> the /etc/hosts file is ignored and also the
>> addn-hosts=<fn>
>> is ignored.
I've had the same feeling some time ago, with no resolution:
https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2020q2/014063.html
>> This then results in the problem, that the
>> DHCP-server still works, but if you use the
>>
>> dhcp-host=da:7a:3a:62:7d:d2,trb
>>
>> where trb is a name in /etc/hosts
>> dnsmasq reacts with:
>>
>> DHCPDISCOVER(enp2s0) da:7a:3a:62:7d:d2 no address available
>>
>> I checked via strace that it really doesn't even open
>> /etc/hosts nor the given file via the "addn-hosts" option.
>>
>> Looks for me like a bug. I can not find a logical reason, why a dhcp-server
>> *needs* to have a running DNS-server.
>>
>> Or is it a feature? :-)
On 22.10.22 21:15, Geert Stappers via Dnsmasq-discuss wrote:
>Or an incomplete configuration file.
>So remove the 'port=0' (or comment it out) and check if
>the host with MAC-address gets the IP-address of trb.
Turris OS (openwrt clone) released new version this week, I can check again
when I get to it. However, changing port to non-zero helped in my case.
I'm not very skilled in C, so I can only guess:
src/cache.c seems to ignore hosts cache when port is set to 0
there may be of course different places the cache is filled
#ifdef HAVE_DHCP
struct in_addr a_record_from_hosts(char *name, time_t now)
{
struct crec *crecp = NULL;
struct in_addr ret;
/* If no DNS service, cache not initialised. */
if (daemon->port != 0)
while ((crecp = cache_find_by_name(crecp, name, now, F_IPV4)))
if (crecp->flags & F_HOSTS)
return crecp->addr.addr4;
my_syslog(MS_DHCP | LOG_WARNING, _("No IPv4 address found for %s"), name);
ret.s_addr = 0;
return ret;
}
--
Matus UHLAR - fantomas, uhlar at fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Fighting for peace is like fucking for virginity...
More information about the Dnsmasq-discuss
mailing list