Normally, when a 'resquery_t' object is created in fctx_query(),
we call dns_adb_beginudpfetch() (which increases the ADB quota)
only if it's a UDP query. Then, in fctx_cancelquery(), we call
dns_adb_endudpfetch() to decreases back the ADB quota, again only
if it's a UDP query.
The problem is that a UDP query can become a TCP query, preventing
the quota from adjusting back in fctx_cancelquery() later.
Call dns_adb_beginudpfetch() also when switching the query type
from UDP to TCP.
(cherry picked from commit
53afe1f978c7c46d961a00d2149f333bf6f0b687)
hint = dns_adb_getudpsize(fctx->adb,
query->addrinfo);
} else if (tried->count >= 2U) {
- query->options |= DNS_FETCHOPT_TCP;
+ if ((query->options & DNS_FETCHOPT_TCP) == 0) {
+ /*
+ * Inform the ADB that we're ending a
+ * UDP fetch, and turn the query into
+ * a TCP query.
+ */
+ dns_adb_endudpfetch(fctx->adb,
+ query->addrinfo);
+ query->options |= DNS_FETCHOPT_TCP;
+ }
}
}
}