Fix query-combining for queries with class other than IN.

Along the way, use of extract_request() and extract_name() got further
refined.
This commit is contained in:
Simon Kelley
2025-02-09 22:03:22 +00:00
parent 0ccbdf8087
commit 7c1212e3d1
4 changed files with 77 additions and 71 deletions

View File

@@ -1238,7 +1238,8 @@ void report_addresses(struct dns_header *header, size_t len, u32 mark)
/* If the packet holds exactly one query
return F_IPV4 or F_IPV6 and leave the name from the query in name */
unsigned int extract_request(struct dns_header *header, size_t qlen, char *name, unsigned short *typep)
unsigned int extract_request(struct dns_header *header, size_t qlen, char *name,
unsigned short *typep, unsigned short *classp)
{
unsigned char *p = (unsigned char *)(header+1);
int qtype, qclass;
@@ -1263,6 +1264,9 @@ unsigned int extract_request(struct dns_header *header, size_t qlen, char *name,
if (typep)
*typep = qtype;
if (classp)
*classp = qclass;
if (qclass == C_IN)
{
if (qtype == T_A)