From: Michael Tremer Date: Thu, 21 May 2026 15:37:10 +0000 (+0000) Subject: misc-progs: dnsctrl: Tool to reload the DNS system X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df88ee12d04cfd6cd94620abc6d1718aaf33fb02;p=ipfire-2.x.git misc-progs: dnsctrl: Tool to reload the DNS system Signed-off-by: Michael Tremer --- diff --git a/config/rootfiles/common/misc-progs b/config/rootfiles/common/misc-progs index 996eba42a..94d213e19 100644 --- a/config/rootfiles/common/misc-progs +++ b/config/rootfiles/common/misc-progs @@ -5,6 +5,7 @@ usr/local/bin/captivectrl usr/local/bin/collectdctrl usr/local/bin/ddnsctrl usr/local/bin/dhcpctrl +usr/local/bin/dnsctrl usr/local/bin/extrahdctrl usr/local/bin/fireinfoctrl usr/local/bin/firewallctrl diff --git a/src/misc-progs/Makefile b/src/misc-progs/Makefile index fe4f28cf4..6229c8b17 100644 --- a/src/misc-progs/Makefile +++ b/src/misc-progs/Makefile @@ -32,7 +32,7 @@ SUID_PROGS = squidctrl sshctrl ipfirereboot \ smartctrl clamavctrl addonctrl pakfire wlanapctrl \ setaliases urlfilterctrl updxlratorctrl fireinfoctrl rebuildroutes \ getconntracktable wirelessclient torctrl ddnsctrl \ - captivectrl wireguardctrl lldpdctrl + captivectrl wireguardctrl lldpdctrl dnsctrl OBJS = $(patsubst %,%.o,$(PROGS) $(SUID_PROGS)) diff --git a/src/misc-progs/dnsctrl.c b/src/misc-progs/dnsctrl.c new file mode 100644 index 000000000..8f4955116 --- /dev/null +++ b/src/misc-progs/dnsctrl.c @@ -0,0 +1,34 @@ +/* This file is part of the IPFire Firewall. + * + * This program is distributed under the terms of the GNU General Public + * Licence. See the file COPYING for details. + * + */ + +#include +#include + +#include "setuid.h" + +int main(int argc, char** argv) { + // Become root + if (!initsetuid()) + exit(1); + + // Check if we have enough arguments + if (argc < 2) { + fprintf(stderr, "\nNot enough arguments.\n\n"); + exit(1); + } + + if (strcmp(argv[1], "reload") == 0) { + char* args[] = { + "reload", NULL, + }; + + return run("/etc/rc.d/init.d/knot-resolver", args); + } + + fprintf(stderr, "Invalid command\n"); + exit(1); +}