New source port for DNSSEC-originated queries.

This commit is contained in:
Simon Kelley
2014-01-08 16:53:27 +00:00
parent 7d7b7b31e5
commit f1668d2786

View File

@@ -718,6 +718,10 @@ void reply_query(int fd, int family, time_t now)
new->next = next; new->next = next;
new->stash = NULL; new->stash = NULL;
new->blocking_query = NULL; new->blocking_query = NULL;
new->rfd4 = NULL;
#ifdef HAVE_IPV6
new->rfd6 = NULL;
#endif
new->flags &= ~(FREC_DNSKEY_QUERY | FREC_DS_QUERY); new->flags &= ~(FREC_DNSKEY_QUERY | FREC_DS_QUERY);
if ((forward->stash = blockdata_alloc((char *)header, n))) if ((forward->stash = blockdata_alloc((char *)header, n)))
@@ -751,23 +755,27 @@ void reply_query(int fd, int family, time_t now)
if (server->sfd) if (server->sfd)
fd = server->sfd->fd; fd = server->sfd->fd;
else else
{
fd = -1;
#ifdef HAVE_IPV6 #ifdef HAVE_IPV6
/* Note that we use the same random port for the DNSSEC stuff */ if (server->addr.sa.sa_family == AF_INET6)
if (server->addr.sa.sa_family == AF_INET6) {
{ if (new->rfd6 || (new->rfd6 = allocate_rfd(AF_INET6)))
fd = new->rfd6->fd; fd = new->rfd6->fd;
new->rfd6->refcount++; }
} else
else
#endif #endif
{ {
fd = new->rfd4->fd; if (new->rfd4 || (new->rfd4 = allocate_rfd(AF_INET)))
new->rfd4->refcount++; fd = new->rfd4->fd;
} }
}
/* Send DNSSEC query to same server as original query */ if (fd != -1)
while (sendto(fd, (char *)header, nn, 0, &server->addr.sa, sa_len(&server->addr)) == -1 && retry_send()); {
server->queries++; while (sendto(fd, (char *)header, nn, 0, &server->addr.sa, sa_len(&server->addr)) == -1 && retry_send());
server->queries++;
}
} }
} }
@@ -1142,7 +1150,7 @@ static int tcp_key_recurse(time_t now, int status, int class, char *keyname, str
{ {
my_syslog(LOG_ERR, _("Unexpected missing data for DNSSEC validation")); my_syslog(LOG_ERR, _("Unexpected missing data for DNSSEC validation"));
status = STAT_INSECURE; status = STAT_INSECURE;
} }
} }
} }
} }