You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.6 KiB
80 lines
2.6 KiB
diff -up dhcp-4.2.5/configure.ac.sd-daemon dhcp-4.2.5/configure.ac |
|
--- dhcp-4.2.5/configure.ac.sd-daemon 2014-07-07 12:13:21.474322606 +0200 |
|
+++ dhcp-4.2.5/configure.ac 2014-07-07 12:16:11.320964893 +0200 |
|
@@ -714,6 +714,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_TRY_COMPILE & etc). |
|
CFLAGS="$CFLAGS $STD_CWARNINGS" |
|
diff -up dhcp-4.2.5/relay/dhcrelay.c.sd-daemon dhcp-4.2.5/relay/dhcrelay.c |
|
--- dhcp-4.2.5/relay/dhcrelay.c.sd-daemon 2014-07-07 12:13:21.329324619 +0200 |
|
+++ dhcp-4.2.5/relay/dhcrelay.c 2014-07-07 12:13:21.475322592 +0200 |
|
@@ -41,6 +41,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]; |
|
@@ -608,6 +612,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.2.5/server/dhcpd.c.sd-daemon dhcp-4.2.5/server/dhcpd.c |
|
--- dhcp-4.2.5/server/dhcpd.c.sd-daemon 2014-07-07 12:13:21.419323370 +0200 |
|
+++ dhcp-4.2.5/server/dhcpd.c 2014-07-07 12:16:57.838319165 +0200 |
|
@@ -60,6 +60,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 |
|
@@ -869,6 +873,15 @@ main(int argc, char **argv) { |
|
(omapi_object_t *)0, "state", server_running); |
|
|
|
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 (); |
|
|
|
|