2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

TLS: isc_nm_bad_request() and isc__nmsocket_reset() support

This commit adds implementations of isc_nm_bad_request() and
isc__nmsocket_reset() to the generic TLS stream code in order to make
it more compatible with TCP code.
This commit is contained in:
Artem Boldariev
2022-07-26 17:07:19 +03:00
parent 858e06e58d
commit c0808532e1
3 changed files with 24 additions and 4 deletions

View File

@@ -1563,6 +1563,9 @@ isc__nm_tls_cleartimeout(isc_nmhandle_t *handle);
* around.
*/
void
isc__nmsocket_tls_reset(isc_nmsocket_t *sock);
const char *
isc__nm_tls_verify_tls_peer_result_string(const isc_nmhandle_t *handle);

View File

@@ -2330,6 +2330,11 @@ isc__nmsocket_reset(isc_nmsocket_t *sock) {
*/
REQUIRE(sock->parent == NULL);
break;
#ifdef HAVE_LIBNGHTTP2
case isc_nm_tlssocket:
isc__nmsocket_tls_reset(sock);
return;
#endif /* HAVE_LIBNGHTTP2 */
default:
UNREACHABLE();
break;
@@ -2548,6 +2553,10 @@ isc_nm_bad_request(isc_nmhandle_t *handle) {
return;
case isc_nm_tcpdnssocket:
case isc_nm_tlsdnssocket:
case isc_nm_tcpsocket:
#if HAVE_LIBNGHTTP2
case isc_nm_tlssocket:
#endif /* HAVE_LIBNGHTTP2 */
REQUIRE(sock->parent == NULL);
isc__nmsocket_reset(sock);
return;
@@ -2555,10 +2564,6 @@ isc_nm_bad_request(isc_nmhandle_t *handle) {
case isc_nm_httpsocket:
isc__nm_http_bad_request(handle);
return;
#endif /* HAVE_LIBNGHTTP2 */
case isc_nm_tcpsocket:
#if HAVE_LIBNGHTTP2
case isc_nm_tlssocket:
#endif /* HAVE_LIBNGHTTP2 */
default:
UNREACHABLE();

View File

@@ -1203,6 +1203,18 @@ isc__nmhandle_tls_setwritetimeout(isc_nmhandle_t *handle,
}
}
void
isc__nmsocket_tls_reset(isc_nmsocket_t *sock) {
REQUIRE(VALID_NMSOCK(sock));
REQUIRE(sock->type == isc_nm_tlssocket);
if (sock->outerhandle != NULL) {
INSIST(VALID_NMHANDLE(sock->outerhandle));
REQUIRE(VALID_NMSOCK(sock->outerhandle->sock));
isc__nmsocket_reset(sock->outerhandle->sock);
}
}
const char *
isc__nm_tls_verify_tls_peer_result_string(const isc_nmhandle_t *handle) {
isc_nmsocket_t *sock = NULL;