mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Fix ipset support.
This fixes a problem with ipset processing that got recently introduced when `extract_request` filtering was tightened. During the recent change an incorrect assumption was made that `extract_request` was only called for requests but with ipset it is also called when processing responses. The fix ensures that the new filters only apply to requests (QR=0 @ hdr) Signed-off-by: Etan Kissling <etan.kissling@gmail.com>
This commit is contained in:
committed by
Simon Kelley
parent
a38bb31727
commit
9d806c51c2
@@ -982,10 +982,12 @@ unsigned int extract_request(struct dns_header *header, size_t qlen, char *name,
|
|||||||
|
|
||||||
*name = 0; /* return empty name if no query found. */
|
*name = 0; /* return empty name if no query found. */
|
||||||
|
|
||||||
if (ntohs(header->qdcount) != 1 || OPCODE(header) != QUERY ||
|
if (ntohs(header->qdcount) != 1 || OPCODE(header) != QUERY)
|
||||||
ntohs(header->ancount) != 0 || ntohs(header->nscount) != 0)
|
|
||||||
return 0; /* must be exactly one query. */
|
return 0; /* must be exactly one query. */
|
||||||
|
|
||||||
|
if (!(header->hb3 & HB3_QR) && (ntohs(header->ancount) != 0 || ntohs(header->nscount) != 0))
|
||||||
|
return 0; /* non-standard query. */
|
||||||
|
|
||||||
if (!extract_name(header, qlen, &p, name, 1, 4))
|
if (!extract_name(header, qlen, &p, name, 1, 4))
|
||||||
return 0; /* bad packet */
|
return 0; /* bad packet */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user