79 lines
2.6 KiB
Diff
79 lines
2.6 KiB
Diff
diff -up dhcp-4.3.0/configure.ac.sd-daemon dhcp-4.3.0/configure.ac
|
|
--- dhcp-4.3.0/configure.ac.sd-daemon 2014-03-18 15:17:11.000000000 +0100
|
|
+++ dhcp-4.3.0/configure.ac 2014-03-18 15:35:47.982182345 +0100
|
|
@@ -677,6 +677,17 @@ if test x$ldap = xyes || test x$ldapcryp
|
|
fi
|
|
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-daemon, sd_notify, ,
|
|
+ AC_MSG_FAILURE([*** sd-daemon 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.0/relay/dhcrelay.c.sd-daemon dhcp-4.3.0/relay/dhcrelay.c
|
|
--- dhcp-4.3.0/relay/dhcrelay.c.sd-daemon 2014-03-18 15:17:11.000000000 +0100
|
|
+++ dhcp-4.3.0/relay/dhcrelay.c 2014-03-18 15:35:42.063264999 +0100
|
|
@@ -36,6 +36,10 @@
|
|
int keep_capabilities = 0;
|
|
#endif
|
|
|
|
+#ifdef HAVE_LIBSYSTEMD_DAEMON
|
|
+#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];
|
|
@@ -624,6 +628,14 @@ main(int argc, char **argv) {
|
|
}
|
|
#endif
|
|
|
|
+#ifdef HAVE_LIBSYSTEMD_DAEMON
|
|
+ /* 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.0/server/dhcpd.c.sd-daemon dhcp-4.3.0/server/dhcpd.c
|
|
--- dhcp-4.3.0/server/dhcpd.c.sd-daemon 2014-03-18 15:17:11.000000000 +0100
|
|
+++ dhcp-4.3.0/server/dhcpd.c 2014-03-18 15:34:59.207863458 +0100
|
|
@@ -54,6 +54,10 @@ static const char url [] =
|
|
|
|
#include "trace.h"
|
|
|
|
+#ifdef HAVE_LIBSYSTEMD_DAEMON
|
|
+#include <systemd/sd-daemon.h>
|
|
+#endif
|
|
+
|
|
#ifndef UNIT_TEST
|
|
static void usage(void);
|
|
#endif
|
|
@@ -792,6 +796,13 @@ main(int argc, char **argv) {
|
|
|
|
TRACE(DHCPD_MAIN());
|
|
|
|
+#ifdef HAVE_LIBSYSTEMD_DAEMON
|
|
+ /* 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.
|