Do not create server_domain for non-server records
--local=/example/ and --address=/example/# create records, which contain
no address or just NULL address. Some people generate quite large
blocklists, which then can take quite long to walk through. Because it
uses linear algorithm, it gets quite slow.
Similar to upstream in 2.86, avoid walking through literal addresses or
local blocks. Speeds up significantly loading of 50k or more records.
Fixed regression caused by commit 73f4c86bcc
Resolves: rhbz#2209031
This commit is contained in:
parent
c17ee32e3e
commit
418de6681f
106
dnsmasq-2.85-domain-blocklist-speedup.patch
Normal file
106
dnsmasq-2.85-domain-blocklist-speedup.patch
Normal file
@ -0,0 +1,106 @@
|
||||
From e046f32d882b6acf2090cbe8830c2dea6279aa8e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
|
||||
Date: Fri, 9 Jun 2023 22:11:01 +0200
|
||||
Subject: [PATCH] Use serv_domain only for regular servers
|
||||
|
||||
Do not try to use it for --local=/x/ or --address=/x/#. Some users use
|
||||
quite long list of blocks, which slows down walking trough domain list
|
||||
considerably. But searching by server_domain_find_domain is needed only
|
||||
for normal servers, which may store there last used server and number
|
||||
of recent forwarded queries. Local addresses overrides store there no
|
||||
useful information, avoid searching and adding new domains for such
|
||||
records.
|
||||
|
||||
Would also speed up searching servers when blocklists are used, because
|
||||
only domains of servers are tested.
|
||||
|
||||
Resolves: rhbz#2209031
|
||||
---
|
||||
src/forward.c | 2 +-
|
||||
src/option.c | 15 +++++++++------
|
||||
2 files changed, 10 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/forward.c b/src/forward.c
|
||||
index fffab7a..3d1227b 100644
|
||||
--- a/src/forward.c
|
||||
+++ b/src/forward.c
|
||||
@@ -249,7 +249,7 @@ static unsigned int search_servers(time_t now, union all_addr **addrpp, unsigned
|
||||
*type = 0; /* use normal servers for this domain */
|
||||
*domain = NULL;
|
||||
}
|
||||
- if (serv_domain && !*serv_domain)
|
||||
+ if (serv_domain && !*serv_domain && (*type & SERV_HAS_DOMAIN)==0)
|
||||
*serv_domain = server_domain_find_domain(NULL);
|
||||
return flags;
|
||||
}
|
||||
diff --git a/src/option.c b/src/option.c
|
||||
index e4e3182..25680c0 100644
|
||||
--- a/src/option.c
|
||||
+++ b/src/option.c
|
||||
@@ -928,7 +928,7 @@ static struct server *add_rev4(struct in_addr addr, int msize)
|
||||
p += sprintf(p, "in-addr.arpa");
|
||||
|
||||
serv->flags = SERV_HAS_DOMAIN;
|
||||
- server_domain_new(serv);
|
||||
+ serv->serv_domain = NULL;
|
||||
serv->next = daemon->servers;
|
||||
daemon->servers = serv;
|
||||
|
||||
@@ -953,7 +953,7 @@ static struct server *add_rev6(struct in6_addr *addr, int msize)
|
||||
p += sprintf(p, "ip6.arpa");
|
||||
|
||||
serv->flags = SERV_HAS_DOMAIN;
|
||||
- server_domain_new(serv);
|
||||
+ serv->serv_domain = NULL;
|
||||
serv->next = daemon->servers;
|
||||
daemon->servers = serv;
|
||||
|
||||
@@ -2294,7 +2294,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
||||
memset(serv, 0, sizeof(struct server));
|
||||
serv->domain = d;
|
||||
serv->flags = SERV_HAS_DOMAIN | SERV_NO_ADDR;
|
||||
- server_domain_new(serv);
|
||||
+ serv->serv_domain = NULL;
|
||||
serv->next = daemon->servers;
|
||||
daemon->servers = serv;
|
||||
}
|
||||
@@ -2338,7 +2338,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
||||
memset(serv, 0, sizeof(struct server));
|
||||
serv->domain = d;
|
||||
serv->flags = SERV_HAS_DOMAIN | SERV_NO_ADDR;
|
||||
- server_domain_new(serv);
|
||||
+ serv->serv_domain = NULL;
|
||||
serv->next = daemon->servers;
|
||||
daemon->servers = serv;
|
||||
}
|
||||
@@ -2591,7 +2591,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
||||
newlist = serv;
|
||||
serv->domain = domain;
|
||||
serv->flags = domain ? SERV_HAS_DOMAIN : SERV_FOR_NODOTS;
|
||||
- server_domain_new(serv);
|
||||
+ serv->serv_domain = NULL;
|
||||
arg = end;
|
||||
if (rebind)
|
||||
break;
|
||||
@@ -2639,6 +2639,8 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
||||
server_list_free(newlist);
|
||||
ret_err(err);
|
||||
}
|
||||
+ if ((newlist->flags & SERV_LITERAL_ADDRESS)==0)
|
||||
+ server_domain_new(newlist);
|
||||
}
|
||||
|
||||
serv = newlist;
|
||||
@@ -2682,7 +2684,8 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
||||
serv = add_rev6(&addr6, size);
|
||||
else
|
||||
ret_err(gen_err);
|
||||
-
|
||||
+
|
||||
+ server_domain_new(serv);
|
||||
string = parse_server(comma, &serv->addr, &serv->source_addr, serv->interface, &serv->flags);
|
||||
|
||||
if (string)
|
||||
--
|
||||
2.40.1
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
Name: dnsmasq
|
||||
Version: 2.85
|
||||
Release: 10%{?extraversion:.%{extraversion}}%{?dist}
|
||||
Release: 11%{?extraversion:.%{extraversion}}%{?dist}
|
||||
Summary: A lightweight DHCP/caching DNS server
|
||||
|
||||
License: GPLv2 or GPLv3
|
||||
@ -62,6 +62,9 @@ Patch11: dnsmasq-2.85-search_servers-rhbz2182342.patch
|
||||
# Downstream only patch; https://bugzilla.redhat.com/show_bug.cgi?id=2186481
|
||||
# complements patch10
|
||||
Patch12: dnsmasq-2.85-serv_domain-rh2186481-2.patch
|
||||
# Downstream only patch; https://bugzilla.redhat.com/show_bug.cgi?id=2209031
|
||||
# complements patch12
|
||||
Patch14: dnsmasq-2.85-domain-blocklist-speedup.patch
|
||||
|
||||
# This is workaround to nettle bug #1549190
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1549190
|
||||
@ -205,6 +208,9 @@ install -Dpm 644 %{SOURCE2} %{buildroot}%{_sysusersdir}/%{name}.conf
|
||||
%{_mandir}/man1/dhcp_*
|
||||
|
||||
%changelog
|
||||
* Fri Jun 09 2023 Petr Menšík <pemensik@redhat.com> - 2.85-11
|
||||
- Do not create and search --local and --address=/x/# domains (#2209031)
|
||||
|
||||
* Wed May 10 2023 Petr Menšík <pemensik@redhat.com> - 2.85-10
|
||||
- Fix also dynamically set resolvers over dbus (#2186481)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user