|
|
d4e403 |
diff -up dhcp-4.2.5/configure.ac.sd-daemon dhcp-4.2.5/configure.ac
|
|
|
d4e403 |
--- dhcp-4.2.5/configure.ac.sd-daemon 2014-07-07 12:13:21.474322606 +0200
|
|
|
d4e403 |
+++ dhcp-4.2.5/configure.ac 2014-07-07 12:16:11.320964893 +0200
|
|
|
d4e403 |
@@ -714,6 +714,17 @@ if test x$ldap = xyes || test x$ldapcryp
|
|
|
d4e403 |
fi
|
|
|
d4e403 |
fi
|
|
|
d4e403 |
|
|
|
d4e403 |
+AC_ARG_WITH(systemd,
|
|
|
d4e403 |
+ AC_HELP_STRING([--with-systemd],
|
|
|
d4e403 |
+ [enable sending status notifications to systemd daemon (default is no)]),
|
|
|
d4e403 |
+ [systemd=$withval],
|
|
|
d4e403 |
+ [systemd=no])
|
|
|
d4e403 |
+
|
|
|
d4e403 |
+if test x$systemd = xyes ; then
|
|
|
d4e403 |
+ AC_CHECK_LIB(systemd-daemon, sd_notify, ,
|
|
|
d4e403 |
+ AC_MSG_FAILURE([*** sd-daemon library not present - do you need to install systemd-libs package?]))
|
|
|
d4e403 |
+fi
|
|
|
d4e403 |
+
|
|
|
d4e403 |
# Append selected warning levels to CFLAGS before substitution (but after
|
|
|
d4e403 |
# AC_TRY_COMPILE & etc).
|
|
|
d4e403 |
CFLAGS="$CFLAGS $STD_CWARNINGS"
|
|
|
d4e403 |
diff -up dhcp-4.2.5/relay/dhcrelay.c.sd-daemon dhcp-4.2.5/relay/dhcrelay.c
|
|
|
d4e403 |
--- dhcp-4.2.5/relay/dhcrelay.c.sd-daemon 2014-07-07 12:13:21.329324619 +0200
|
|
|
d4e403 |
+++ dhcp-4.2.5/relay/dhcrelay.c 2014-07-07 12:13:21.475322592 +0200
|
|
|
d4e403 |
@@ -41,6 +41,10 @@
|
|
|
d4e403 |
int keep_capabilities = 0;
|
|
|
d4e403 |
#endif
|
|
|
d4e403 |
|
|
|
d4e403 |
+#ifdef HAVE_LIBSYSTEMD_DAEMON
|
|
|
d4e403 |
+#include <systemd/sd-daemon.h>
|
|
|
d4e403 |
+#endif
|
|
|
d4e403 |
+
|
|
|
d4e403 |
TIME default_lease_time = 43200; /* 12 hours... */
|
|
|
d4e403 |
TIME max_lease_time = 86400; /* 24 hours... */
|
|
|
d4e403 |
struct tree_cache *global_options[256];
|
|
|
d4e403 |
@@ -608,6 +612,14 @@ main(int argc, char **argv) {
|
|
|
d4e403 |
}
|
|
|
d4e403 |
#endif
|
|
|
d4e403 |
|
|
|
d4e403 |
+#ifdef HAVE_LIBSYSTEMD_DAEMON
|
|
|
d4e403 |
+ /* We are ready to process incomming packets. Let's notify systemd */
|
|
|
d4e403 |
+ sd_notifyf(0, "READY=1\n"
|
|
|
d4e403 |
+ "STATUS=Dispatching packets...\n"
|
|
|
d4e403 |
+ "MAINPID=%lu",
|
|
|
d4e403 |
+ (unsigned long) getpid());
|
|
|
d4e403 |
+#endif
|
|
|
d4e403 |
+
|
|
|
d4e403 |
/* Start dispatching packets and timeouts... */
|
|
|
d4e403 |
dispatch();
|
|
|
d4e403 |
|
|
|
d4e403 |
diff -up dhcp-4.2.5/server/dhcpd.c.sd-daemon dhcp-4.2.5/server/dhcpd.c
|
|
|
d4e403 |
--- dhcp-4.2.5/server/dhcpd.c.sd-daemon 2014-07-07 12:13:21.419323370 +0200
|
|
|
d4e403 |
+++ dhcp-4.2.5/server/dhcpd.c 2014-07-07 12:16:57.838319165 +0200
|
|
|
d4e403 |
@@ -60,6 +60,10 @@ static const char url [] =
|
|
|
d4e403 |
|
|
|
d4e403 |
#include "trace.h"
|
|
|
d4e403 |
|
|
|
d4e403 |
+#ifdef HAVE_LIBSYSTEMD_DAEMON
|
|
|
d4e403 |
+#include <systemd/sd-daemon.h>
|
|
|
d4e403 |
+#endif
|
|
|
d4e403 |
+
|
|
|
d4e403 |
#ifndef UNIT_TEST
|
|
|
d4e403 |
static void usage(void);
|
|
|
d4e403 |
#endif
|
|
|
d4e403 |
@@ -869,6 +873,15 @@ main(int argc, char **argv) {
|
|
|
d4e403 |
(omapi_object_t *)0, "state", server_running);
|
|
|
d4e403 |
|
|
|
d4e403 |
TRACE(DHCPD_MAIN());
|
|
|
d4e403 |
+
|
|
|
d4e403 |
+#ifdef HAVE_LIBSYSTEMD_DAEMON
|
|
|
d4e403 |
+ /* We are ready to process incomming packets. Let's notify systemd */
|
|
|
d4e403 |
+ sd_notifyf(0, "READY=1\n"
|
|
|
d4e403 |
+ "STATUS=Dispatching packets...\n"
|
|
|
d4e403 |
+ "MAINPID=%lu",
|
|
|
d4e403 |
+ (unsigned long) getpid());
|
|
|
d4e403 |
+#endif
|
|
|
d4e403 |
+
|
|
|
d4e403 |
/* Receive packets and dispatch them... */
|
|
|
d4e403 |
dispatch ();
|
|
|
d4e403 |
|