From 192df8d2f1f396731d357042e486892e56a228e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Mon, 25 Apr 2022 13:38:33 +0200 Subject: [PATCH] The route socket and its storage was detached while still reading The interfacemgr and the .route was being detached while the network manager had pending read from the socket. Instead of detaching from the socket, we need to cancel the read which in turn will detach the route socket and the associated interfacemgr. (cherry picked from commit 9ae34a04e86ec60d0e11188de3ba6617cd00a92e) --- lib/ns/interfacemgr.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/ns/interfacemgr.c b/lib/ns/interfacemgr.c index 8a905dcd32..8ab96a08f0 100644 --- a/lib/ns/interfacemgr.c +++ b/lib/ns/interfacemgr.c @@ -215,16 +215,9 @@ route_recv(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region, return; } - if (eresult == ISC_R_SHUTTINGDOWN) { - /* - * The mgr->route and mgr is detached in - * ns_interfacemgr_shutdown() - */ - return; - } - if (eresult != ISC_R_SUCCESS) { - if (eresult != ISC_R_CANCELED) { + if (eresult != ISC_R_CANCELED && eresult != ISC_R_SHUTTINGDOWN) + { isc_log_write(IFMGR_COMMON_LOGARGS, ISC_LOG_ERROR, "automatic interface scanning " "terminated: %s", @@ -451,8 +444,7 @@ ns_interfacemgr_shutdown(ns_interfacemgr_t *mgr) { purge_old_interfaces(mgr); if (mgr->route != NULL) { - isc_nmhandle_detach(&mgr->route); - ns_interfacemgr_detach(&mgr); + isc_nm_cancelread(mgr->route); } }