mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Combine queries for the same DNS name if close in time.
If two queries arrive a second or so apart, they cannot be a try and a retry from the same client (retries are at least three seconds apart.) It's therefore safe not to forward the second query, but answer them both when the reply arrives for the first.
This commit is contained in:
@@ -366,6 +366,12 @@ static int forward_query(int udpfd, union mysockaddr *udpaddr,
|
||||
src->log_id = daemon->log_id;
|
||||
src->iface = dst_iface;
|
||||
src->fd = udpfd;
|
||||
|
||||
/* closely spaced identical queries cannot be a try and a retry, so
|
||||
it's safe to wait for the reply from the first without
|
||||
forwarding the second. */
|
||||
if (difftime(now, forward->time) < 2)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user