From 325dbb025cd932a42bd340ef567ce3dd8e256c7c Mon Sep 17 00:00:00 2001 From: Jiri Popelka Date: May 29 2014 14:28:10 +0000 Subject: dhcp-sd_notify.patch BuildRequires: pkgconfig(libsystemd) --- diff --git a/dhcp-sd-daemon.patch b/dhcp-sd-daemon.patch deleted file mode 100644 index ae48a9a..0000000 --- a/dhcp-sd-daemon.patch +++ /dev/null @@ -1,78 +0,0 @@ -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, 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.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 -+#include -+#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 -+ /* 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 -+#include -+#endif -+ - #ifndef UNIT_TEST - static void usage(void); - #endif -@@ -792,6 +796,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. diff --git a/dhcp-sd_notify.patch b/dhcp-sd_notify.patch new file mode 100644 index 0000000..ae48a9a --- /dev/null +++ b/dhcp-sd_notify.patch @@ -0,0 +1,78 @@ +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, 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.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 ++#include ++#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 ++ /* 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 ++#include ++#endif ++ + #ifndef UNIT_TEST + static void usage(void); + #endif +@@ -792,6 +796,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. diff --git a/dhcp.spec b/dhcp.spec index 347163a..f8db24d 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -18,7 +18,7 @@ Summary: Dynamic host configuration protocol software Name: dhcp Version: 4.3.0 -Release: 11%{?dist} +Release: 12%{?dist} # NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to # dcantrell maintaining the package) made incorrect use of the epoch and # that's why it is at 12 now. It should have never been used, but it was. @@ -78,7 +78,7 @@ Patch39: dhcp-range6.patch Patch40: dhcp-next-server.patch Patch41: dhcp-no-subnet-error2info.patch Patch42: dhcp-ffff-checksum.patch -Patch43: dhcp-sd-daemon.patch +Patch43: dhcp-sd_notify.patch BuildRequires: autoconf BuildRequires: automake @@ -87,6 +87,8 @@ BuildRequires: openldap-devel BuildRequires: libcap-ng-devel BuildRequires: bind-lite-devel >= 32:9.9.5-0.1.b1 BuildRequires: systemd systemd-devel +# dhcp-sd_notify.patch +BuildRequires: pkgconfig(libsystemd) BuildRequires: doxygen %if %sdt BuildRequires: systemtap-sdt-devel @@ -349,7 +351,7 @@ rm -rf includes/isc-dhcp %patch42 -p1 -b .ffff # support for sending startup notification to systemd (#1077666) -%patch43 -p1 -b .sd-daemon +%patch43 -p1 -b .sd_notify # Update paths in all man pages for page in client/dhclient.conf.5 client/dhclient.leases.5 \ @@ -622,6 +624,9 @@ done %doc doc/html/ %changelog +* Thu May 29 2014 Jiri Popelka - 12:4.3.0-12 +- dhcp-sd_notify.patch BuildRequires: pkgconfig(libsystemd) + * Wed May 28 2014 Jiri Popelka - 12:4.3.0-11 - dhclient-script: fix stateless DHCPv6 mode (#1101149)