Rebuild server array after each change
On /etc/resolv.conf of d-bus update of servers, dnsmasq did not update dnsmasq_daemon->serverarray properly. Call refresh after each change. When resolv.conf resolvers are cleared, dnsmasq_daemon->serverarray were not properly refreshed. Force refresh as part of removal. Replaces original upstream commit, which fixed only some use-cases: http://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=commit;h=d290630d31f4517ab26392d00753d1397f9a4114 Resolves: rhbz#2009975 Related: rhbz#2014019
This commit is contained in:
parent
cee3418eae
commit
19d9817a3e
67
dnsmasq-2.86-build_server_array.patch
Normal file
67
dnsmasq-2.86-build_server_array.patch
Normal file
@ -0,0 +1,67 @@
|
||||
From 068e849c713fa5e95eeb210792c061b7e212eab5 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
|
||||
Date: Wed, 13 Oct 2021 16:58:39 +0200
|
||||
Subject: [PATCH] Ensure serverarray is rebuilt once server can be removed
|
||||
|
||||
Because cleanup_servers is called from each place which can remove
|
||||
server, use that function to refresh serverarray after changes. Make it
|
||||
static, since it does not have to be called from other places.
|
||||
---
|
||||
src/dnsmasq.h | 1 -
|
||||
src/domain-match.c | 8 +++++++-
|
||||
src/network.c | 1 -
|
||||
3 files changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/dnsmasq.h b/src/dnsmasq.h
|
||||
index 08f2785..3f82412 100644
|
||||
--- a/src/dnsmasq.h
|
||||
+++ b/src/dnsmasq.h
|
||||
@@ -1757,7 +1757,6 @@ void dump_packet(int mask, void *packet, size_t len, union mysockaddr *src, unio
|
||||
#endif
|
||||
|
||||
/* domain-match.c */
|
||||
-void build_server_array(void);
|
||||
int lookup_domain(char *qdomain, int flags, int *lowout, int *highout);
|
||||
int filter_servers(int seed, int flags, int *lowout, int *highout);
|
||||
int is_local_answer(time_t now, int first, char *name);
|
||||
diff --git a/src/domain-match.c b/src/domain-match.c
|
||||
index 45528c1..e5b409e 100644
|
||||
--- a/src/domain-match.c
|
||||
+++ b/src/domain-match.c
|
||||
@@ -23,7 +23,7 @@ static int order_servers(struct server *s, struct server *s2);
|
||||
/* If the server is USE_RESOLV or LITERAL_ADDRES, it lives on the local_domains chain. */
|
||||
#define SERV_IS_LOCAL (SERV_USE_RESOLV | SERV_LITERAL_ADDRESS)
|
||||
|
||||
-void build_server_array(void)
|
||||
+static void build_server_array(void)
|
||||
{
|
||||
struct server *serv;
|
||||
int count = 0;
|
||||
@@ -592,6 +592,12 @@ void cleanup_servers(void)
|
||||
else
|
||||
up = &serv->next;
|
||||
}
|
||||
+
|
||||
+ /* If we're delaying things, we don't call check_servers(), but
|
||||
+ reload_servers() may have deleted some servers, rendering the server_array
|
||||
+ invalid, so just rebuild that here. Once reload_servers() succeeds,
|
||||
+ we call check_servers() above, which calls build_server_array itself. */
|
||||
+ build_server_array();
|
||||
}
|
||||
|
||||
int add_update_server(int flags,
|
||||
diff --git a/src/network.c b/src/network.c
|
||||
index 3fc179d..0b68866 100644
|
||||
--- a/src/network.c
|
||||
+++ b/src/network.c
|
||||
@@ -1653,7 +1653,6 @@ void check_servers(int no_loop_check)
|
||||
}
|
||||
|
||||
cleanup_servers(); /* remove servers we just deleted. */
|
||||
- build_server_array();
|
||||
}
|
||||
|
||||
/* Return zero if no servers found, in that case we keep polling.
|
||||
--
|
||||
2.31.1
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
Name: dnsmasq
|
||||
Version: 2.86
|
||||
Release: 2%{?extraversion:.%{extraversion}}%{?dist}
|
||||
Release: 3%{?extraversion:.%{extraversion}}%{?dist}
|
||||
Summary: A lightweight DHCP/caching DNS server
|
||||
|
||||
License: GPLv2 or GPLv3
|
||||
@ -59,6 +59,9 @@ Patch23: 0014-Fix-coverity-detected-issues-in-dnsmasq.c.patch
|
||||
Patch24: 0015-Fix-coverity-issues-in-dnssec.c.patch
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=2006367
|
||||
Patch25: dnsmasq-2.86-domain-match-local.patch
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=2009975
|
||||
# replaces/enhances http://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=commit;h=d290630d31f4517ab26392d00753d1397f9a4114
|
||||
Patch26: dnsmasq-2.86-build_server_array.patch
|
||||
|
||||
|
||||
|
||||
@ -202,6 +205,9 @@ install -Dpm 644 %{SOURCE2} %{buildroot}%{_sysusersdir}/%{name}.conf
|
||||
%{_mandir}/man1/dhcp_*
|
||||
|
||||
%changelog
|
||||
* Thu Oct 14 2021 Petr Menšík <pemensik@redhat.com> - 2.86-3
|
||||
- Rebuild server_array on any server change (#2009975)
|
||||
|
||||
* Thu Sep 23 2021 Petr Menšík <pemensik@redhat.com> - 2.86-2
|
||||
- Attempt to fix regression found on recent release (#2006367)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user