mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Don't re-use datastructures for --address and --local.
Doing so makes the loading process quadratic, which is a problem when there are a large number.
This commit is contained in:
@@ -531,7 +531,7 @@ int add_update_server(int flags,
|
|||||||
const char *domain,
|
const char *domain,
|
||||||
union all_addr *local_addr)
|
union all_addr *local_addr)
|
||||||
{
|
{
|
||||||
struct server *serv;
|
struct server *serv = NULL;
|
||||||
char *alloc_domain;
|
char *alloc_domain;
|
||||||
|
|
||||||
if (!domain || strlen(domain) == 0)
|
if (!domain || strlen(domain) == 0)
|
||||||
@@ -539,12 +539,14 @@ int add_update_server(int flags,
|
|||||||
else if (!(alloc_domain = canonicalise((char *)domain, NULL)))
|
else if (!(alloc_domain = canonicalise((char *)domain, NULL)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* See if there is a suitable candidate, and unmark */
|
/* See if there is a suitable candidate, and unmark
|
||||||
for (serv = (flags & SERV_IS_LOCAL) ? daemon->local_domains : daemon->servers; serv; serv = serv->next)
|
only do this for forwarding servers, not
|
||||||
if ((serv->flags & SERV_MARK) &&
|
address or local, to avoid delays on large numbers. */
|
||||||
hostname_isequal(alloc_domain, serv->domain) &&
|
if (flags & SERV_IS_LOCAL)
|
||||||
((serv->flags & (SERV_6ADDR | SERV_4ADDR)) == (flags & (SERV_6ADDR | SERV_4ADDR))))
|
for (serv = daemon->servers; serv; serv = serv->next)
|
||||||
break;
|
if ((serv->flags & SERV_MARK) &&
|
||||||
|
hostname_isequal(alloc_domain, serv->domain))
|
||||||
|
break;
|
||||||
|
|
||||||
if (serv)
|
if (serv)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user