mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Fix order of calls to resize-packet() and add_pseudoheader().
Avoids malformed replies with EDE in certain circumstances.
This commit is contained in:
@@ -734,12 +734,6 @@ static size_t process_reply(struct dns_header *header, time_t now, struct server
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (pheader && ede != -1)
|
|
||||||
{
|
|
||||||
u16 swap = htons((u16)ede);
|
|
||||||
n = add_pseudoheader(header, n, limit, daemon->edns_pktsz, EDNS0_OPTION_EDE, (unsigned char *)&swap, 2, do_bit, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* do this after extract_addresses. Ensure NODATA reply and remove
|
/* do this after extract_addresses. Ensure NODATA reply and remove
|
||||||
nameserver info. */
|
nameserver info. */
|
||||||
if (munged)
|
if (munged)
|
||||||
@@ -753,7 +747,15 @@ static size_t process_reply(struct dns_header *header, time_t now, struct server
|
|||||||
/* the bogus-nxdomain stuff, doctor and NXDOMAIN->NODATA munging can all elide
|
/* the bogus-nxdomain stuff, doctor and NXDOMAIN->NODATA munging can all elide
|
||||||
sections of the packet. Find the new length here and put back pseudoheader
|
sections of the packet. Find the new length here and put back pseudoheader
|
||||||
if it was removed. */
|
if it was removed. */
|
||||||
return resize_packet(header, n, pheader, plen);
|
n = resize_packet(header, n, pheader, plen);
|
||||||
|
|
||||||
|
if (pheader && ede != -1)
|
||||||
|
{
|
||||||
|
u16 swap = htons((u16)ede);
|
||||||
|
n = add_pseudoheader(header, n, limit, daemon->edns_pktsz, EDNS0_OPTION_EDE, (unsigned char *)&swap, 2, do_bit, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_DNSSEC
|
#ifdef HAVE_DNSSEC
|
||||||
|
|||||||
Reference in New Issue
Block a user