Fix init of per server EDNS UDP packet size.

This commit is contained in:
Simon Kelley
2016-04-25 16:36:44 +01:00
parent 87985855ad
commit 14ffa0770b
3 changed files with 17 additions and 14 deletions

View File

@@ -61,6 +61,10 @@ version 2.76
garbage dhcp-options being sent. Thanks to Marc Branchaud garbage dhcp-options being sent. Thanks to Marc Branchaud
for spotting this. for spotting this.
Fix wrong value for EDNS UDP packet size when using
--servers-file to define upstream DNS servers. Thanks to
Scott Bonar for the bug report.
version 2.75 version 2.75
Fix reversion on 2.74 which caused 100% CPU use when a Fix reversion on 2.74 which caused 100% CPU use when a

View File

@@ -1409,7 +1409,6 @@ void add_update_server(int flags,
serv->domain = domain_str; serv->domain = domain_str;
serv->next = next; serv->next = next;
serv->queries = serv->failed_queries = 0; serv->queries = serv->failed_queries = 0;
serv->edns_pktsz = daemon->edns_pktsz;
#ifdef HAVE_LOOP #ifdef HAVE_LOOP
serv->uid = rand32(); serv->uid = rand32();
#endif #endif
@@ -1447,6 +1446,10 @@ void check_servers(void)
{ {
if (!(serv->flags & (SERV_LITERAL_ADDRESS | SERV_NO_ADDR | SERV_USE_RESOLV | SERV_NO_REBIND))) if (!(serv->flags & (SERV_LITERAL_ADDRESS | SERV_NO_ADDR | SERV_USE_RESOLV | SERV_NO_REBIND)))
{ {
/* Init edns_pktsz for newly created server records. */
if (serv->edns_pktsz == 0)
serv->edns_pktsz = daemon->edns_pktsz;
#ifdef HAVE_DNSSEC #ifdef HAVE_DNSSEC
if (option_bool(OPT_DNSSEC_VALID)) if (option_bool(OPT_DNSSEC_VALID))
{ {

View File

@@ -4612,19 +4612,15 @@ void read_opts(int argc, char **argv, char *compile_opts)
{ {
struct server *tmp; struct server *tmp;
for (tmp = daemon->servers; tmp; tmp = tmp->next) for (tmp = daemon->servers; tmp; tmp = tmp->next)
{ if (!(tmp->flags & SERV_HAS_SOURCE))
tmp->edns_pktsz = daemon->edns_pktsz; {
if (tmp->source_addr.sa.sa_family == AF_INET)
if (!(tmp->flags & SERV_HAS_SOURCE)) tmp->source_addr.in.sin_port = htons(daemon->query_port);
{
if (tmp->source_addr.sa.sa_family == AF_INET)
tmp->source_addr.in.sin_port = htons(daemon->query_port);
#ifdef HAVE_IPV6 #ifdef HAVE_IPV6
else if (tmp->source_addr.sa.sa_family == AF_INET6) else if (tmp->source_addr.sa.sa_family == AF_INET6)
tmp->source_addr.in6.sin6_port = htons(daemon->query_port); tmp->source_addr.in6.sin6_port = htons(daemon->query_port);
#endif #endif
} }
}
} }
if (daemon->host_records) if (daemon->host_records)