mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
DoH: Add isc_nm_set_min_answer_ttl()
This commit adds an isc_nm_set_min_answer_ttl() function which is intended to to be used to give a hint to the underlying transport regarding the answer TTL. The interface is intentionally kept generic because over time more transports might benefit from this functionality, but currently it is intended for DoH to set "max-age" value within "Cache-Control" HTTP header (as recommended in the RFC8484, section 5.1 "Cache Interaction"). It is no-op for other DNS transports for the time being.
This commit is contained in:
@@ -3456,6 +3456,38 @@ isc_nm_is_tlsdns_handle(isc_nmhandle_t *handle) {
|
||||
return (handle->sock->type == isc_nm_tlsdnssocket);
|
||||
}
|
||||
|
||||
void
|
||||
isc_nm_set_maxage(isc_nmhandle_t *handle, const uint32_t ttl) {
|
||||
isc_nmsocket_t *sock;
|
||||
|
||||
REQUIRE(VALID_NMHANDLE(handle));
|
||||
REQUIRE(VALID_NMSOCK(handle->sock));
|
||||
REQUIRE(!atomic_load(&handle->sock->client));
|
||||
|
||||
sock = handle->sock;
|
||||
switch (sock->type) {
|
||||
#if HAVE_LIBNGHTTP2
|
||||
case isc_nm_httpsocket:
|
||||
isc__nm_http_set_maxage(handle, ttl);
|
||||
break;
|
||||
#endif /* HAVE_LIBNGHTTP2 */
|
||||
case isc_nm_udpsocket:
|
||||
case isc_nm_tcpdnssocket:
|
||||
case isc_nm_tlsdnssocket:
|
||||
return;
|
||||
break;
|
||||
|
||||
case isc_nm_tcpsocket:
|
||||
#if HAVE_LIBNGHTTP2
|
||||
case isc_nm_tlssocket:
|
||||
#endif /* HAVE_LIBNGHTTP2 */
|
||||
default:
|
||||
INSIST(0);
|
||||
ISC_UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NETMGR_TRACE
|
||||
/*
|
||||
* Dump all active sockets in netmgr. We output to stderr
|
||||
|
Reference in New Issue
Block a user