Skip to content

Commit

Permalink
Fix crash in PXE/netboot when DNS server disabled.
Browse files Browse the repository at this point in the history
Signed-off-by: DL6ER <dl6er@dl6er.de>
  • Loading branch information
simonkelley authored and DL6ER committed Oct 24, 2021
1 parent f53cf25 commit 29261a5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/dnsmasq/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1400,10 +1400,12 @@ struct in_addr a_record_from_hosts(char *name, time_t now)
struct crec *crecp = NULL;
struct in_addr ret;

while ((crecp = cache_find_by_name(crecp, name, now, F_IPV4)))
if (crecp->flags & F_HOSTS)
return crecp->addr.addr4;

/* 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;
Expand Down

0 comments on commit 29261a5

Please sign in to comment.