summaryrefslogtreecommitdiff
path: root/usr.sbin/nsd/xfrd.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/nsd/xfrd.c')
-rw-r--r--usr.sbin/nsd/xfrd.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/usr.sbin/nsd/xfrd.c b/usr.sbin/nsd/xfrd.c
index 14fec35a28a..4dc87a8074d 100644
--- a/usr.sbin/nsd/xfrd.c
+++ b/usr.sbin/nsd/xfrd.c
@@ -31,6 +31,10 @@
#include "remote.h"
#include "rrl.h"
+#ifdef HAVE_SYSTEMD
+#include <systemd/sd-daemon.h>
+#endif
+
#define XFRD_UDP_TIMEOUT 10 /* seconds, before a udp request times out */
#define XFRD_NO_IXFR_CACHE 172800 /* 48h before retrying ixfr's after notimpl */
#define XFRD_LOWERBOUND_REFRESH 1 /* seconds, smallest refresh timeout */
@@ -222,6 +226,10 @@ xfrd_init(int socket, struct nsd* nsd, int shortsoa, int reload_active,
xfrd_sigsetup(SIGINT);
DEBUG(DEBUG_XFRD,1, (LOG_INFO, "xfrd startup"));
+#ifdef HAVE_SYSTEMD
+ if(xfrd->nsd->options->use_systemd)
+ sd_notify(0, "READY=1");
+#endif
xfrd_main();
}
@@ -324,6 +332,10 @@ xfrd_shutdown()
xfrd_zone_type* zone;
DEBUG(DEBUG_XFRD,1, (LOG_INFO, "xfrd shutdown"));
+#ifdef HAVE_SYSTEMD
+ if(xfrd->nsd->options->use_systemd)
+ sd_notify(0, "STOPPING=1");
+#endif
event_del(&xfrd->ipc_handler);
close(xfrd->ipc_handler.ev_fd); /* notifies parent we stop */
zone_list_close(nsd.options);
@@ -2503,10 +2515,18 @@ void xfrd_process_task_result(xfrd_state_type* xfrd, struct udb_base* taskudb)
* reload, this happens when the reload signal is sent, and thus
* the taskudbs are swapped */
task_clear(taskudb);
+#ifdef HAVE_SYSTEMD
+ if(xfrd->nsd->options->use_systemd)
+ sd_notify(0, "READY=1");
+#endif
}
void xfrd_set_reload_now(xfrd_state_type* xfrd)
{
+#ifdef HAVE_SYSTEMD
+ if(xfrd->nsd->options->use_systemd)
+ sd_notify(0, "RELOADING=1");
+#endif
xfrd->need_to_send_reload = 1;
if(!(xfrd->ipc_handler_flags&EV_WRITE)) {
ipc_xfrd_set_listening(xfrd, EV_PERSIST|EV_READ|EV_WRITE);