From f2e681e41896f11df273dae6a1567c4ebe6047b0 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Fri, 5 Jun 2020 17:48:27 -0700 Subject: [PATCH] use isc_nm_cancelread() in isccc_ccmsg_cancelread() when shuttting down a control channel connection, if no valid message has arrived, cancel the read. --- bin/named/controlconf.c | 7 ++++--- lib/isccc/ccmsg.c | 5 +---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/bin/named/controlconf.c b/bin/named/controlconf.c index 9d8aaf9ae0..e02b11a417 100644 --- a/bin/named/controlconf.c +++ b/bin/named/controlconf.c @@ -408,9 +408,10 @@ control_recvmessage(isc_nmhandle_t *handle, isc_result_t result, void *arg) { isccc_time_t exp; uint32_t nonce; + conn->ccmsg_valid = false; + /* Is the server shutting down? */ if (listener->controls->shuttingdown) { - conn->ccmsg_valid = false; return; } @@ -419,7 +420,6 @@ control_recvmessage(isc_nmhandle_t *handle, isc_result_t result, void *arg) { log_invalid(&conn->ccmsg, result); } - conn->ccmsg_valid = false; return; } @@ -445,7 +445,6 @@ control_recvmessage(isc_nmhandle_t *handle, isc_result_t result, void *arg) { REGION_SIZE(conn->secret)); if (result != ISCCC_R_BADAUTH) { log_invalid(&conn->ccmsg, result); - conn->ccmsg_valid = false; return; } } @@ -518,6 +517,8 @@ control_recvmessage(isc_nmhandle_t *handle, isc_result_t result, void *arg) { isc_buffer_allocate(listener->mctx, &conn->text, 2 * 2048); + conn->ccmsg_valid = true; + if (conn->nonce == 0) { /* * Establish nonce. diff --git a/lib/isccc/ccmsg.c b/lib/isccc/ccmsg.c index fce0169f1f..9f2ad61c3c 100644 --- a/lib/isccc/ccmsg.c +++ b/lib/isccc/ccmsg.c @@ -208,10 +208,7 @@ void isccc_ccmsg_cancelread(isccc_ccmsg_t *ccmsg) { REQUIRE(VALID_CCMSG(ccmsg)); -#if 0 - /* XXX: not sure if this is needed with the netmgr */ - isc_socket_cancel(ccmsg->sock, NULL, ISC_SOCKCANCEL_RECV); -#endif + isc_nm_cancelread(ccmsg->handle); } void