public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@mandelbit.com>
To: development@lists.ipfire.org
Cc: Antonio Quartulli <antonio@mandelbit.com>
Subject: [PATCH 1/2] knot-resolver: Add force-reload
Date: Fri, 13 Nov 2026 14:42:42 +0100	[thread overview]
Message-ID: <20261113134243.382773-2-antonio@mandelbit.com> (raw)
In-Reply-To: <20261113134243.382773-1-antonio@mandelbit.com>

A reload doesn't restart the workers when config.yaml is unchanged, so
they keep what their Lua script set up at startup. force-reload (also
available through dnsctrl) replaces them with a rolling restart.

Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
---
 src/initscripts/system/knot-resolver | 9 ++++++++-
 src/misc-progs/dnsctrl.c             | 7 +++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/initscripts/system/knot-resolver b/src/initscripts/system/knot-resolver
index 980a095f3..a27323b37 100644
--- a/src/initscripts/system/knot-resolver
+++ b/src/initscripts/system/knot-resolver
@@ -45,6 +45,13 @@ case "${1}" in
 			--config=/etc/knot-resolver/config.yaml reload
 		;;
 
+	force-reload)
+		# Replace the workers too, so that they re-run the Lua script
+		# (e.g. to register the DNS-over-TLS forwarders)
+		/usr/bin/kresctl \
+			--config=/etc/knot-resolver/config.yaml reload --force
+		;;
+
 	restart)
 		${0} stop
 		sleep 1
@@ -56,7 +63,7 @@ case "${1}" in
 		;;
 
 	*)
-		echo "Usage: ${0} {start|stop|reload|restart|status}"
+		echo "Usage: ${0} {start|stop|reload|force-reload|restart|status}"
 		exit 1
 		;;
 esac
diff --git a/src/misc-progs/dnsctrl.c b/src/misc-progs/dnsctrl.c
index 84b0ae211..66007c8f7 100644
--- a/src/misc-progs/dnsctrl.c
+++ b/src/misc-progs/dnsctrl.c
@@ -28,6 +28,13 @@ int main(int argc, char** argv) {
 
 		return run("/etc/rc.d/init.d/knot-resolver", args);
 
+	} else if (strcmp(argv[1], "force-reload") == 0) {
+		char* args[] = {
+			"force-reload", NULL,
+		};
+
+		return run("/etc/rc.d/init.d/knot-resolver", args);
+
 	} else if (strcmp(argv[1], "sync-rpzs") == 0) {
 		char* args[] = {
 			NULL,
-- 
2.56.0



  reply	other threads:[~2026-11-13 13:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 13:42 [PATCH 0/2] Fix DNS-over-TLS after changing DNS settings (#14781) Antonio Quartulli
2026-11-13 13:42 ` Antonio Quartulli [this message]
2026-11-13 13:42 ` [PATCH 2/2] dns.cgi: Force a reload after every change Antonio Quartulli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261113134243.382773-2-antonio@mandelbit.com \
    --to=antonio@mandelbit.com \
    --cc=development@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox