Blame SOURCES/dhcp-sd_notify.patch

26a25c
diff -up dhcp-4.3.4/configure.ac.sd_notify dhcp-4.3.4/configure.ac
26a25c
--- dhcp-4.3.4/configure.ac.sd_notify	2016-04-29 13:08:52.813287060 +0200
26a25c
+++ dhcp-4.3.4/configure.ac	2016-04-29 13:08:52.872287075 +0200
26a25c
@@ -832,6 +832,17 @@ if test x$ldap = xyes || test x$ldapcryp
26a25c
     AC_SUBST(LDAP_CFLAGS, [$LDAP_CFLAGS])
26a25c
 fi
26a25c
 
26a25c
+AC_ARG_WITH(systemd,
26a25c
+        AC_HELP_STRING([--with-systemd],
26a25c
+                       [enable sending status notifications to systemd daemon (default is no)]),
26a25c
+        [systemd=$withval],
26a25c
+        [systemd=no])
26a25c
+
26a25c
+if test x$systemd = xyes ; then
26a25c
+   AC_CHECK_LIB(systemd, sd_notifyf, ,
26a25c
+                AC_MSG_FAILURE([*** systemd library not present - do you need to install systemd-libs package?]))
26a25c
+fi
26a25c
+
26a25c
 # Append selected warning levels to CFLAGS before substitution (but after
26a25c
 # AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]) & etc).
26a25c
 CFLAGS="$CFLAGS $STD_CWARNINGS"
26a25c
diff -up dhcp-4.3.4/relay/dhcrelay.c.sd_notify dhcp-4.3.4/relay/dhcrelay.c
26a25c
--- dhcp-4.3.4/relay/dhcrelay.c.sd_notify	2016-04-29 13:08:52.814287061 +0200
26a25c
+++ dhcp-4.3.4/relay/dhcrelay.c	2016-04-29 13:08:52.872287075 +0200
26a25c
@@ -37,6 +37,10 @@
26a25c
    int keep_capabilities = 0;
26a25c
 #endif
26a25c
 
26a25c
+#ifdef HAVE_LIBSYSTEMD
26a25c
+#include <systemd/sd-daemon.h>
26a25c
+#endif
26a25c
+
26a25c
 TIME default_lease_time = 43200; /* 12 hours... */
26a25c
 TIME max_lease_time = 86400; /* 24 hours... */
26a25c
 struct tree_cache *global_options[256];
26a25c
@@ -709,6 +713,14 @@ main(int argc, char **argv) {
26a25c
 	}
26a25c
 #endif
26a25c
 
26a25c
+#ifdef HAVE_LIBSYSTEMD
26a25c
+        /* We are ready to process incomming packets. Let's notify systemd */
26a25c
+        sd_notifyf(0, "READY=1\n"
26a25c
+                   "STATUS=Dispatching packets...\n"
26a25c
+                   "MAINPID=%lu",
26a25c
+                   (unsigned long) getpid());
26a25c
+#endif
26a25c
+
26a25c
 	/* Start dispatching packets and timeouts... */
26a25c
 	dispatch();
26a25c
 
26a25c
diff -up dhcp-4.3.4/server/dhcpd.c.sd_notify dhcp-4.3.4/server/dhcpd.c
26a25c
--- dhcp-4.3.4/server/dhcpd.c.sd_notify	2016-04-29 13:08:52.873287075 +0200
26a25c
+++ dhcp-4.3.4/server/dhcpd.c	2016-04-29 13:12:00.655333096 +0200
26a25c
@@ -57,6 +57,10 @@ uid_t set_uid = 0;
26a25c
 gid_t set_gid = 0;
26a25c
 #endif /* PARANOIA */
26a25c
 
26a25c
+#ifdef HAVE_LIBSYSTEMD
26a25c
+#include <systemd/sd-daemon.h>
26a25c
+#endif
26a25c
+
26a25c
 struct iaddr server_identifier;
26a25c
 int server_identifier_matched;
26a25c
 
26a25c
@@ -931,6 +935,14 @@ main(int argc, char **argv) {
26a25c
 	/* Log that we are about to start working */
26a25c
 	log_info("Server starting service.");
26a25c
 
26a25c
+#ifdef HAVE_LIBSYSTEMD
26a25c
+        /* We are ready to process incomming packets. Let's notify systemd */
26a25c
+        sd_notifyf(0, "READY=1\n"
26a25c
+                   "STATUS=Dispatching packets...\n"
26a25c
+                   "MAINPID=%lu",
26a25c
+                   (unsigned long) getpid());
26a25c
+#endif
26a25c
+
26a25c
 	/*
26a25c
 	 * Receive packets and dispatch them...
26a25c
 	 * dispatch() will never return.