From 1da786ce0d00b409159995763e1a1a4e2f941c50 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 13 Sep 2022 03:40:04 -0400 Subject: [PATCH] import dnsmasq-2.79-21.el8_6.1 --- .../dnsmasq-2.79-server-domain-fixup.patch | 99 +++++++++++++++++++ SPECS/dnsmasq.spec | 8 +- 2 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 SOURCES/dnsmasq-2.79-server-domain-fixup.patch diff --git a/SOURCES/dnsmasq-2.79-server-domain-fixup.patch b/SOURCES/dnsmasq-2.79-server-domain-fixup.patch new file mode 100644 index 0000000..ac90a8f --- /dev/null +++ b/SOURCES/dnsmasq-2.79-server-domain-fixup.patch @@ -0,0 +1,99 @@ +From 4c5cbdfb82e668268a5f3713fe119fb077667c8e Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Mon, 22 Aug 2022 21:59:42 +0200 +Subject: [PATCH] Ensure also server_domains_cleanup is called always + +Fixes issue in patch dnsmasq-2.79-server-domain-rh1919894.patch. + +When /etc/resolv.conf is changed, dnsmasq reloads used servers. But it +does not call cleanup of server domains in this case. It might cause +serv_domain->last_server to become non-null, but pointing released +server. Ensure it is checked before any cleanup_servers() action always +and from all other places, like dbus setting. + +Caused unending loop in forward_query function, rhbz#2106361. +--- + src/network.c | 49 +++++++++++++++++++++++++------------------------ + 1 file changed, 25 insertions(+), 24 deletions(-) + +diff --git a/src/network.c b/src/network.c +index 4d140bb..96668fb 100644 +--- a/src/network.c ++++ b/src/network.c +@@ -1402,10 +1402,35 @@ void mark_servers(int flag) + } + } + ++static void server_domains_cleanup(void) ++{ ++ struct server_domain *sd, *tmp, **up; ++ ++ /* unlink and free anything still marked. */ ++ for (up = &daemon->server_domains, sd=*up; sd; sd = tmp) ++ { ++ tmp = sd->next; ++ if (sd->flags & SERV_MARK) ++ { ++ *up = sd->next; ++ if (sd->domain) ++ free(sd->domain); ++ free(sd); ++ } ++ else { ++ up = &sd->next; ++ if (sd->last_server && (sd->last_server->flags & SERV_MARK)) ++ sd->last_server = NULL; ++ } ++ } ++} ++ + void cleanup_servers(void) + { + struct server *serv, *tmp, **up; + ++ server_domains_cleanup(); ++ + /* unlink and free anything still marked. */ + for (serv = daemon->servers, up = &daemon->servers; serv; serv = tmp) + { +@@ -1428,29 +1453,6 @@ void cleanup_servers(void) + #endif + } + +-void server_domains_cleanup(void) +-{ +- struct server_domain *sd, *tmp, **up; +- +- /* unlink and free anything still marked. */ +- for (up = &daemon->server_domains, sd=*up; sd; sd = tmp) +- { +- tmp = sd->next; +- if (sd->flags & SERV_MARK) +- { +- *up = sd->next; +- if (sd->domain) +- free(sd->domain); +- free(sd); +- } +- else { +- up = &sd->next; +- if (sd->last_server && (sd->last_server->flags & SERV_MARK)) +- sd->last_server = NULL; +- } +- } +-} +- + void add_update_server(int flags, + union mysockaddr *addr, + union mysockaddr *source_addr, +@@ -1739,7 +1741,6 @@ void check_servers(void) + up = &sfd->next; + } + +- server_domains_cleanup(); + cleanup_servers(); + } + +-- +2.37.2 + diff --git a/SPECS/dnsmasq.spec b/SPECS/dnsmasq.spec index 394d8a6..ea10d31 100644 --- a/SPECS/dnsmasq.spec +++ b/SPECS/dnsmasq.spec @@ -13,7 +13,7 @@ Name: dnsmasq Version: 2.79 -Release: 21%{?extraversion:.%{extraversion}}%{?dist} +Release: 21%{?extraversion:.%{extraversion}}%{?dist}.1 Summary: A lightweight DHCP/caching DNS server License: GPLv2 or GPLv3 @@ -73,6 +73,8 @@ Patch33: dnsmasq-2.86-dhcpv6-client-arch.patch # Similar functionality is implemented since 2.86 in upstream, but introduced # several regressions. This implements just limited change in different way. Patch34: dnsmasq-2.79-server-domain-rh1919894.patch +# Downstream only patch; fixes Patch34 change +Patch35: dnsmasq-2.79-server-domain-fixup.patch # This is workaround to nettle bug #1549190 # https://bugzilla.redhat.com/show_bug.cgi?id=1549190 @@ -140,6 +142,7 @@ server's leases. %patch32 -p1 -b .rh1998448 %patch33 -p1 -b .dhcpv6-client-arch %patch34 -p1 -b .rh1919894 +%patch35 -p1 -b .rh2120357 # use /var/lib/dnsmasq instead of /var/lib/misc for file in dnsmasq.conf.example man/dnsmasq.8 man/es/dnsmasq.8 src/config.h; do @@ -239,6 +242,9 @@ install -Dpm 644 %{SOURCE2} %{buildroot}%{_sysusersdir}/dnsmasq.conf %{_mandir}/man1/dhcp_* %changelog +* Mon Aug 22 2022 Petr Menšík - 2.79-21.1 +- Prevent endless loop in forward_query (#2120357) + * Thu Jan 27 2022 Petr Menšík - 2.79-21 - Send queries only to best domain-specific server (#1919894)