mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Return EDE_STALE extended error when returning stale data from cache.
This commit is contained in:
@@ -596,7 +596,7 @@ static int forward_query(int udpfd, union mysockaddr *udpaddr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check if any frecs need to do a retry, and action that if so.
|
/* Check if any frecs need to do a retry, and action that if so.
|
||||||
Return time in milliseconds until he next retyr will be required,
|
Return time in milliseconds until he next retry will be required,
|
||||||
or -1 if none. */
|
or -1 if none. */
|
||||||
int fast_retry(time_t now)
|
int fast_retry(time_t now)
|
||||||
{
|
{
|
||||||
@@ -1790,6 +1790,13 @@ void receive_query(struct listener *listen, time_t now)
|
|||||||
|
|
||||||
if (m >= 1)
|
if (m >= 1)
|
||||||
{
|
{
|
||||||
|
if (stale && have_pseudoheader)
|
||||||
|
{
|
||||||
|
u16 swap = htons(EDE_STALE);
|
||||||
|
|
||||||
|
m = add_pseudoheader(header, m, ((unsigned char *) header) + udp_size, daemon->edns_pktsz,
|
||||||
|
EDNS0_OPTION_EDE, (unsigned char *)&swap, 2, do_bit, 0);
|
||||||
|
}
|
||||||
#ifdef HAVE_DUMPFILE
|
#ifdef HAVE_DUMPFILE
|
||||||
dump_packet_udp(DUMP_REPLY, daemon->packet, m, NULL, &source_addr, listen->fd);
|
dump_packet_udp(DUMP_REPLY, daemon->packet, m, NULL, &source_addr, listen->fd);
|
||||||
#endif
|
#endif
|
||||||
@@ -2390,6 +2397,12 @@ unsigned char *tcp_request(int confd, time_t now,
|
|||||||
m = add_pseudoheader(header, m, ((unsigned char *) header) + 65536, daemon->edns_pktsz, 0, NULL, 0, do_bit, 0);
|
m = add_pseudoheader(header, m, ((unsigned char *) header) + 65536, daemon->edns_pktsz, 0, NULL, 0, do_bit, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (stale)
|
||||||
|
{
|
||||||
|
u16 swap = htons((u16)EDE_STALE);
|
||||||
|
|
||||||
|
m = add_pseudoheader(header, m, ((unsigned char *) header) + 65536, daemon->edns_pktsz, EDNS0_OPTION_EDE, (unsigned char *)&swap, 2, do_bit, 0);
|
||||||
|
}
|
||||||
|
|
||||||
check_log_writer(1);
|
check_log_writer(1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user