]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Allow interrupting dnssec-signzone during signing
authorOndřej Surý <ondrej@isc.org>
Thu, 12 Jan 2023 20:44:31 +0000 (21:44 +0100)
committerOndřej Surý <ondrej@isc.org>
Sun, 22 Jan 2023 19:44:18 +0000 (20:44 +0100)
The signal handler in the isc_loop would wait for all the work to finish
before interrupting the signing.  Add teardown handlers via
isc_loopmgr_teardown() to signal the assignwork() it should stop signing
and bail-out early.

NOTE: The dnssec-signzone binary still can't be interrupted during zone
loading, zone cleaning, nsec(3) chain generation or zone writing.  This
might get addressed in the future if it becomes a problem.

bin/dnssec/dnssec-signzone.c

index 3f8367c4779569e81ba608554c3621db19d970a6..835dc2737a0e6ab22cc71c4d1bb8ea1c1f2245f7 100644 (file)
@@ -1544,6 +1544,13 @@ signapex(void) {
        }
 }
 
+static void
+abortwork(void *arg) {
+       UNUSED(arg);
+
+       atomic_store(&shuttingdown, true);
+}
+
 /*%
  * Assigns a node to a worker thread.  This is protected by the main task's
  * lock.
@@ -3937,13 +3944,13 @@ main(int argc, char *argv[]) {
                 * processors if possible.
                 */
                isc_loopmgr_setup(loopmgr, assignwork, NULL);
+               isc_loopmgr_teardown(loopmgr, abortwork, NULL);
                isc_loopmgr_run(loopmgr);
 
                if (!atomic_load(&finished)) {
                        fatal("process aborted by user");
                }
        }
-       atomic_store(&shuttingdown, true);
        postsign();
        TIME_NOW(&sign_finish);