37 lines
1.7 KiB
Diff
37 lines
1.7 KiB
Diff
Accept DNS name compression in RDATA on parse.
|
|
|
|
c-ares 1.34.8 started rejecting compression pointers inside RDATA for RR
|
|
types that RFC 3597 says must not use them (SRV, NAPTR, etc.). That is
|
|
correct for writers, but a large share of deployed resolvers and caches
|
|
(older BIND, dnsmasq, mDNSResponder on macOS, assorted corporate
|
|
forwarders) still compress SRV targets on the wire, so dns.resolveSrv()
|
|
fails with EBADRESP against those servers.
|
|
|
|
c-ares already refuses to emit compression for these types
|
|
(ares_dns_rec_allow_name_comp gates the writer). This patch keeps the
|
|
parser lenient the way it was before 1.34.8 so existing servers keep
|
|
working, while the writer remains strict.
|
|
|
|
--- a/src/lib/record/ares_dns_parse.c
|
|
+++ b/src/lib/record/ares_dns_parse.c
|
|
@@ -46,14 +46,12 @@
|
|
{
|
|
ares_status_t status;
|
|
char *name = NULL;
|
|
- /* Only RR types defined in RFC1035 may use name compression within their
|
|
- * RDATA (RFC3597). Reject compression pointers for any other type (e.g.
|
|
- * SRV per RFC2782) to match the write-side policy and avoid following
|
|
- * pointers that a non-understanding nameserver could not have rewritten. */
|
|
- ares_bool_t allow_compression =
|
|
- ares_dns_rec_allow_name_comp(ares_dns_rr_get_type(rr));
|
|
|
|
- status = ares_dns_name_parse(buf, &name, is_hostname, allow_compression);
|
|
+ /* Bun: accept compression in RDATA on parse regardless of RR type.
|
|
+ * RFC 3597 says writers must not compress here and the c-ares writer
|
|
+ * already enforces that, but plenty of real resolvers still emit
|
|
+ * compressed SRV/NAPTR targets, so stay lenient when reading. */
|
|
+ status = ares_dns_name_parse(buf, &name, is_hostname, ARES_TRUE);
|
|
if (status != ARES_SUCCESS) {
|
|
return status;
|
|
}
|