mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2026-04-02 00:18:40 +01:00
Fix regression handling non-QUERY requests over TCP.
Regression introduced in 729c16a8ac
This commit is contained in:
@@ -2442,10 +2442,10 @@ void tcp_request(int confd, time_t now, struct iovec *bigbuff,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
/* Now get the query into the normal UDP packet buffer.
|
/* Now get the query into the normal UDP packet buffer.
|
||||||
Ignore queries long than this. If we're answering locally,
|
Ignore queries longer than this. If we're answering locally,
|
||||||
copy the query into the output buffer, but for forwarding, tcp_talk()
|
copy the query into the output buffer, but for forwarding, tcp_talk()
|
||||||
wants the query in a a different buffer from the reply.
|
wants the query in different buffer from the reply.
|
||||||
Note that we overwrote any saved UDP query - this onlt matters in debug mode. */
|
Note that we overwrote any saved UDP query - this only matters in debug mode. */
|
||||||
daemon->srv_save = NULL;
|
daemon->srv_save = NULL;
|
||||||
if (!read_write(confd, (unsigned char *)&tcp_len, sizeof(tcp_len), RW_READ) ||
|
if (!read_write(confd, (unsigned char *)&tcp_len, sizeof(tcp_len), RW_READ) ||
|
||||||
!(size = ntohs(tcp_len)) || size > (size_t)daemon->packet_buff_sz ||
|
!(size = ntohs(tcp_len)) || size > (size_t)daemon->packet_buff_sz ||
|
||||||
@@ -2461,6 +2461,15 @@ void tcp_request(int confd, time_t now, struct iovec *bigbuff,
|
|||||||
|
|
||||||
/* header == query */
|
/* header == query */
|
||||||
header = (struct dns_header *)daemon->packet;
|
header = (struct dns_header *)daemon->packet;
|
||||||
|
|
||||||
|
/* Add edns0 pheader to query */
|
||||||
|
size = add_edns0_config(header, size, ((unsigned char *) header) + daemon->edns_pktsz, &peer_addr, now, &cacheable);
|
||||||
|
|
||||||
|
/* Clear buffer to avoid risk of information disclosure. */
|
||||||
|
memset(bigbuff->iov_base, 0, bigbuff->iov_len);
|
||||||
|
/* Copy query into output buffer for local answering */
|
||||||
|
memcpy(out_header, header, size);
|
||||||
|
|
||||||
query_count++;
|
query_count++;
|
||||||
|
|
||||||
/* log_query gets called indirectly all over the place, so
|
/* log_query gets called indirectly all over the place, so
|
||||||
@@ -2493,13 +2502,6 @@ void tcp_request(int confd, time_t now, struct iovec *bigbuff,
|
|||||||
do_bit = 1; /* do bit */
|
do_bit = 1; /* do bit */
|
||||||
}
|
}
|
||||||
|
|
||||||
size = add_edns0_config(header, size, ((unsigned char *) header) + daemon->edns_pktsz, &peer_addr, now, &cacheable);
|
|
||||||
|
|
||||||
/* Clear buffer to avoid risk of information disclosure. */
|
|
||||||
memset(bigbuff->iov_base, 0, bigbuff->iov_len);
|
|
||||||
/* Copy query into output buffer for local answering */
|
|
||||||
memcpy(out_header, header, size);
|
|
||||||
|
|
||||||
log_query_mysockaddr((auth_dns ? F_NOERR | F_AUTH : 0) | F_QUERY | F_FORWARD, daemon->namebuff,
|
log_query_mysockaddr((auth_dns ? F_NOERR | F_AUTH : 0) | F_QUERY | F_FORWARD, daemon->namebuff,
|
||||||
&peer_addr, NULL, qtype);
|
&peer_addr, NULL, qtype);
|
||||||
|
|
||||||
@@ -2552,7 +2554,7 @@ void tcp_request(int confd, time_t now, struct iovec *bigbuff,
|
|||||||
else if (!allowed)
|
else if (!allowed)
|
||||||
{
|
{
|
||||||
ede = EDE_BLOCKED;
|
ede = EDE_BLOCKED;
|
||||||
m = answer_disallowed(header, size, (u32)mark, daemon->namebuff);
|
m = answer_disallowed(out_header, size, (u32)mark, daemon->namebuff);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_AUTH
|
#ifdef HAVE_AUTH
|
||||||
@@ -2568,7 +2570,7 @@ void tcp_request(int confd, time_t now, struct iovec *bigbuff,
|
|||||||
/* Do this by steam now we're not in the select() loop */
|
/* Do this by steam now we're not in the select() loop */
|
||||||
check_log_writer(1);
|
check_log_writer(1);
|
||||||
|
|
||||||
if (m == 0 && ede == EDE_UNSET)
|
if (!flags && m == 0 && ede == EDE_UNSET)
|
||||||
{
|
{
|
||||||
struct server *master;
|
struct server *master;
|
||||||
int start;
|
int start;
|
||||||
|
|||||||
Reference in New Issue
Block a user