79 lines
2.6 KiB
Diff
79 lines
2.6 KiB
Diff
diff -up dhcp-4.3.3b1/configure.ac.sd_notify dhcp-4.3.3b1/configure.ac
|
|
--- dhcp-4.3.3b1/configure.ac.sd_notify 2015-08-10 11:57:24.955325674 +0200
|
|
+++ dhcp-4.3.3b1/configure.ac 2015-08-10 11:58:20.024113933 +0200
|
|
@@ -777,6 +777,17 @@ if test x$ldap = xyes || test x$ldapcryp
|
|
AC_SUBST(LDAP_CFLAGS, [$LDAP_CFLAGS])
|
|
fi
|
|
|
|
+AC_ARG_WITH(systemd,
|
|
+ AC_HELP_STRING([--with-systemd],
|
|
+ [enable sending status notifications to systemd daemon (default is no)]),
|
|
+ [systemd=$withval],
|
|
+ [systemd=no])
|
|
+
|
|
+if test x$systemd = xyes ; then
|
|
+ AC_CHECK_LIB(systemd, sd_notifyf, ,
|
|
+ AC_MSG_FAILURE([*** systemd library not present - do you need to install systemd-libs package?]))
|
|
+fi
|
|
+
|
|
# Append selected warning levels to CFLAGS before substitution (but after
|
|
# AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]) & etc).
|
|
CFLAGS="$CFLAGS $STD_CWARNINGS"
|
|
diff -up dhcp-4.3.3b1/relay/dhcrelay.c.sd_notify dhcp-4.3.3b1/relay/dhcrelay.c
|
|
--- dhcp-4.3.3b1/relay/dhcrelay.c.sd_notify 2015-08-10 11:57:24.901325882 +0200
|
|
+++ dhcp-4.3.3b1/relay/dhcrelay.c 2015-08-10 11:57:24.956325670 +0200
|
|
@@ -36,6 +36,10 @@
|
|
int keep_capabilities = 0;
|
|
#endif
|
|
|
|
+#ifdef HAVE_LIBSYSTEMD
|
|
+#include <systemd/sd-daemon.h>
|
|
+#endif
|
|
+
|
|
TIME default_lease_time = 43200; /* 12 hours... */
|
|
TIME max_lease_time = 86400; /* 24 hours... */
|
|
struct tree_cache *global_options[256];
|
|
@@ -627,6 +631,14 @@ main(int argc, char **argv) {
|
|
}
|
|
#endif
|
|
|
|
+#ifdef HAVE_LIBSYSTEMD
|
|
+ /* We are ready to process incomming packets. Let's notify systemd */
|
|
+ sd_notifyf(0, "READY=1\n"
|
|
+ "STATUS=Dispatching packets...\n"
|
|
+ "MAINPID=%lu",
|
|
+ (unsigned long) getpid());
|
|
+#endif
|
|
+
|
|
/* Start dispatching packets and timeouts... */
|
|
dispatch();
|
|
|
|
diff -up dhcp-4.3.3b1/server/dhcpd.c.sd_notify dhcp-4.3.3b1/server/dhcpd.c
|
|
--- dhcp-4.3.3b1/server/dhcpd.c.sd_notify 2015-08-10 11:57:24.937325743 +0200
|
|
+++ dhcp-4.3.3b1/server/dhcpd.c 2015-08-10 11:57:24.956325670 +0200
|
|
@@ -58,6 +58,10 @@ gid_t set_gid = 0;
|
|
|
|
#include "trace.h"
|
|
|
|
+#ifdef HAVE_LIBSYSTEMD
|
|
+#include <systemd/sd-daemon.h>
|
|
+#endif
|
|
+
|
|
#ifndef UNIT_TEST
|
|
static void usage(void);
|
|
#endif
|
|
@@ -820,6 +824,13 @@ main(int argc, char **argv) {
|
|
|
|
TRACE(DHCPD_MAIN());
|
|
|
|
+#ifdef HAVE_LIBSYSTEMD
|
|
+ /* We are ready to process incomming packets. Let's notify systemd */
|
|
+ sd_notifyf(0, "READY=1\n"
|
|
+ "STATUS=Dispatching packets...\n"
|
|
+ "MAINPID=%lu",
|
|
+ (unsigned long) getpid());
|
|
+#endif
|
|
/*
|
|
* Receive packets and dispatch them...
|
|
* dispatch() will never return.
|