mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 13:38:26 +00:00
enable keepalive when the keepalive EDNS option is seen
previously, receiving a keepalive option had no effect on how long named would keep the connection open; there was a place to configure the keepalive timeout but it was never used. this commit corrects that. this also fixes an error in isc__nm_{tcp,tls}dns_keepalive() in which the sense of a REQUIRE test was reversed; previously this error had not been noticed because the functions were not being used.
This commit is contained in:
parent
19e24e22f5
commit
7867b8b57d
@ -161,6 +161,18 @@ isc_nmhandle_cleartimeout(isc_nmhandle_t *handle);
|
||||
* both socket layers.
|
||||
*/
|
||||
|
||||
void
|
||||
isc_nmhandle_keepalive(isc_nmhandle_t *handle, bool value);
|
||||
/*%<
|
||||
* Enable/disable keepalive on this connection by setting it to 'value'.
|
||||
*
|
||||
* When keepalive is active, we switch to using the keepalive timeout
|
||||
* to determine when to close a connection, rather than the idle timeout.
|
||||
*
|
||||
* This applies only to TCP-based DNS connections (i.e., TCPDNS or
|
||||
* TLSDNS). On other types of connection it has no effect.
|
||||
*/
|
||||
|
||||
isc_sockaddr_t
|
||||
isc_nmhandle_peeraddr(isc_nmhandle_t *handle);
|
||||
/*%<
|
||||
|
@ -2365,6 +2365,22 @@ isc_nmhandle_settimeout(isc_nmhandle_t *handle, uint32_t timeout) {
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
isc_nmhandle_keepalive(isc_nmhandle_t *handle, bool value) {
|
||||
REQUIRE(VALID_NMHANDLE(handle));
|
||||
|
||||
switch (handle->sock->type) {
|
||||
case isc_nm_tcpdnssocket:
|
||||
isc__nm_tcpdns_keepalive(handle, value);
|
||||
break;
|
||||
case isc_nm_tlsdnssocket:
|
||||
isc__nm_tlsdns_keepalive(handle, value);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void *
|
||||
isc_nmhandle_getextra(isc_nmhandle_t *handle) {
|
||||
REQUIRE(VALID_NMHANDLE(handle));
|
||||
|
@ -1442,7 +1442,7 @@ isc__nm_tcpdns_keepalive(isc_nmhandle_t *handle, bool value) {
|
||||
|
||||
REQUIRE(VALID_NMHANDLE(handle));
|
||||
REQUIRE(VALID_NMSOCK(handle->sock));
|
||||
REQUIRE(handle->sock->type != isc_nm_tcpdnssocket);
|
||||
REQUIRE(handle->sock->type == isc_nm_tcpdnssocket);
|
||||
|
||||
sock = handle->sock;
|
||||
|
||||
|
@ -2012,7 +2012,7 @@ isc__nm_tlsdns_keepalive(isc_nmhandle_t *handle, bool value) {
|
||||
|
||||
REQUIRE(VALID_NMHANDLE(handle));
|
||||
REQUIRE(VALID_NMSOCK(handle->sock));
|
||||
REQUIRE(handle->sock->type != isc_nm_tlsdnssocket);
|
||||
REQUIRE(handle->sock->type == isc_nm_tlsdnssocket);
|
||||
|
||||
sock = handle->sock;
|
||||
|
||||
|
@ -1508,6 +1508,7 @@ process_opt(ns_client_t *client, dns_rdataset_t *opt) {
|
||||
}
|
||||
client->attributes |=
|
||||
NS_CLIENTATTR_USEKEEPALIVE;
|
||||
isc_nmhandle_keepalive(client->handle, true);
|
||||
isc_buffer_forward(&optbuf, optlen);
|
||||
break;
|
||||
case DNS_OPT_PAD:
|
||||
|
Loading…
x
Reference in New Issue
Block a user