]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
The route socket and its storage was detached while still reading
authorOndřej Surý <ondrej@isc.org>
Mon, 25 Apr 2022 11:38:33 +0000 (13:38 +0200)
committerOndřej Surý <ondrej@isc.org>
Mon, 25 Apr 2022 15:19:33 +0000 (17:19 +0200)
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.

lib/ns/interfacemgr.c

index 4d278f850356dbfbbdbefe0bdde8d00d17b9e83f..d62b8d92d4be748dd735b3a8ad3ce1597d94c15f 100644 (file)
@@ -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",
@@ -453,8 +446,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);
        }
 }