summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Kelley <simon@thekelleys.org.uk>2021-10-19 15:33:41 +0100
committerSimon Kelley <simon@thekelleys.org.uk>2021-10-19 15:33:41 +0100
commit9560658c5ba27a370b97d30850db474ce67912b7 (patch)
tree4153609f157dd6ea0d5f19d7296124caba3c6eed
parent37a70d39e0cd49f086b757937fa8735e6263cd7a (diff)
downloaddnsmasq-9560658c5ba27a370b97d30850db474ce67912b7.tar.gz
Fix crash in PXE/netboot when DNS server disabled.
-rw-r--r--CHANGELOG4
-rw-r--r--debian/changelog3
-rw-r--r--src/cache.c10
3 files changed, 12 insertions, 5 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 7a2e168..f202bbf 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -11,7 +11,11 @@ version 2.87
Add --filter-A and --filter-AAAA options, to remove IPv4 or IPv6
addresses from DNS answers.
+ Fix crash doing netbooting when --port is set to zero
+ to disable the DNS server. Thanks to Drexl Johannes
+ for the bug report.
+
version 2.86
Handle DHCPREBIND requests in the DHCPv6 server code.
Thanks to Aichun Li for spotting this omission, and the initial
diff --git a/debian/changelog b/debian/changelog
index 53e10cb..d8fb3dc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,8 @@
dnsmasq (2.87-1) unstable; urgency=low
* New upstream.
- * Include new NFTset support in the build.
+ * Include new NFTset support in the build.
+ * Fix crash on netboot with DNS server disabled. (closes: #996332)
-- Simon Kelley <simon@thekelleys.org.uk> Wed, 08 Sep 2021 23:11:25 +0000
diff --git a/src/cache.c b/src/cache.c
index e1d17c4..f9a874c 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -1399,10 +1399,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;