Don't log bogus source address when doing fast retry.

This commit is contained in:
Simon Kelley
2024-10-12 23:21:58 +01:00
parent d15d371051
commit 0338aa4586
2 changed files with 7 additions and 3 deletions

View File

@@ -2299,7 +2299,7 @@ void log_query(unsigned int flags, char *name, union all_addr *addr, char *arg,
if (display_id < 0) if (display_id < 0)
display_id = -display_id; display_id = -display_id;
if (flags & F_NOEXTRA) if (flags & F_NOEXTRA || !daemon->log_source_addr)
my_syslog(LOG_INFO, "%s%u %s %s%s%s %s%s", proto, display_id, source, name, gap, verb, dest, extra); my_syslog(LOG_INFO, "%s%u %s %s%s%s %s%s", proto, display_id, source, name, gap, verb, dest, extra);
else else
{ {

View File

@@ -645,6 +645,7 @@ int fast_retry(time_t now)
GETSHORT(udp_size, udpsz); GETSHORT(udp_size, udpsz);
daemon->log_display_id = f->frec_src.log_id; daemon->log_display_id = f->frec_src.log_id;
daemon->log_source_addr = NULL;
forward_query(-1, NULL, NULL, 0, header, f->stash_len, ((char *) header) + udp_size, now, f, forward_query(-1, NULL, NULL, 0, header, f->stash_len, ((char *) header) + udp_size, now, f,
f->flags & FREC_AD_QUESTION, f->flags & FREC_DO_QUESTION, 1); f->flags & FREC_AD_QUESTION, f->flags & FREC_DO_QUESTION, 1);
@@ -1355,7 +1356,7 @@ void return_reply(time_t now, struct frec *forward, struct dns_header *header, s
(void)status; (void)status;
daemon->log_display_id = forward->frec_src.log_id; daemon->log_display_id = forward->frec_src.log_id;
daemon->log_source_addr = &forward->frec_src.source; daemon->log_source_addr = (forward->frec_src.fd != -1) ? &forward->frec_src.source : NULL;
/* Don't cache replies where DNSSEC validation was turned off, either /* Don't cache replies where DNSSEC validation was turned off, either
the upstream server told us so, or the original query specified it. */ the upstream server told us so, or the original query specified it. */
@@ -1938,6 +1939,9 @@ void receive_query(struct listener *listen, time_t now)
refresh that. */ refresh that. */
m = 0; m = 0;
/* Don't mark the query with the source in this case. */
daemon->log_source_addr = NULL;
/* We've already answered the client, so don't send it the answer /* We've already answered the client, so don't send it the answer
when it comes back. */ when it comes back. */
fd = -1; fd = -1;