diff --git a/config-report.sh.in b/config-report.sh.in index 1af984e..ddd4b62 100755 --- a/config-report.sh.in +++ b/config-report.sh.in @@ -105,6 +105,18 @@ Netconf: no HERE_DOCUMENT fi +if test '@HAVE_LIBSYSTEMD_DAEMON@' != 'no'; then +add_to_report < #include +#ifdef HAVE_LIBSYSTEMD_DAEMON +#include +#endif + using namespace isc::asiolink; using namespace isc::config; using namespace isc::data; @@ -42,7 +46,15 @@ CtrlAgentProcess::init() { void CtrlAgentProcess::run() { + LOG_INFO(agent_logger, CTRL_AGENT_STARTED).arg(VERSION); +#ifdef HAVE_LIBSYSTEMD_DAEMON + // Notify systemd about the same + sd_notifyf(0, "READY=1\n" + "STATUS=Processing requests...\n" + "MAINPID=%lu", + (unsigned long) getpid()); +#endif LOG_WARN(agent_logger, CTRL_AGENT_IS_DEPRECATED); diff --git a/src/bin/agent/meson.build b/src/bin/agent/meson.build index c6afbfa..2d30179 100644 --- a/src/bin/agent/meson.build +++ b/src/bin/agent/meson.build @@ -1,3 +1,8 @@ +kea_ctrl_agent_dependencies = [CRYPTO_DEP] +if SYSTEMD_DEP.found() + kea_ctrl_agent_dependencies += [SYSTEMD_DEP] +endif + agent_lib = static_library( 'agent', 'agent_lexer.cc', @@ -17,7 +22,7 @@ agent_lib = static_library( executable( 'kea-ctrl-agent', 'main.cc', - dependencies: [CRYPTO_DEP], + dependencies: kea_ctrl_agent_dependencies, include_directories: [include_directories('.')] + INCLUDES, install: true, install_dir: SBINDIR, diff --git a/src/bin/d2/d2_process.cc b/src/bin/d2/d2_process.cc index 7db49a3..cdb9cef 100644 --- a/src/bin/d2/d2_process.cc +++ b/src/bin/d2/d2_process.cc @@ -21,6 +21,10 @@ #include #include +#ifdef HAVE_LIBSYSTEMD_DAEMON +#include +#endif + using namespace isc::asiolink; using namespace isc::config; using namespace isc::data; @@ -95,6 +99,13 @@ D2Process::init() { void D2Process::run() { LOG_INFO(d2_logger, DHCP_DDNS_STARTED).arg(VERSION); +#ifdef HAVE_LIBSYSTEMD_DAEMON + // Notify systemd about the same + sd_notifyf(0, "READY=1\n" + "STATUS=Dispatching packets...\n" + "MAINPID=%lu", + (unsigned long) getpid()); +#endif if (!PathChecker::shouldEnforceSecurity()) { LOG_WARN(d2_logger, DHCP_DDNS_SECURITY_CHECKS_DISABLED); diff --git a/src/bin/d2/meson.build b/src/bin/d2/meson.build index 012b40d..3aff0c1 100644 --- a/src/bin/d2/meson.build +++ b/src/bin/d2/meson.build @@ -1,3 +1,8 @@ +kea_ddns_dependencies = [CRYPTO_DEP] +if SYSTEMD_DEP.found() + kea_ddns_dependencies += [SYSTEMD_DEP] +endif + d2_lib = static_library( 'd2', 'check_exists_add.cc', @@ -21,7 +26,7 @@ d2_lib = static_library( executable( 'kea-dhcp-ddns', 'main.cc', - dependencies: [CRYPTO_DEP], + dependencies: kea_ddns_dependencies, include_directories: [include_directories('.')] + INCLUDES, install: true, install_dir: SBINDIR, diff --git a/src/bin/dhcp4/main.cc b/src/bin/dhcp4/main.cc index 4f88e29..5581b7a 100644 --- a/src/bin/dhcp4/main.cc +++ b/src/bin/dhcp4/main.cc @@ -24,6 +24,10 @@ #include +#ifdef HAVE_LIBSYSTEMD_DAEMON +#include +#endif + using namespace isc::data; using namespace isc::dhcp; using namespace isc::process; @@ -290,6 +294,13 @@ main(int argc, char* argv[]) { // Tell the admin we are ready to process packets LOG_INFO(dhcp4_logger, DHCP4_STARTED).arg(VERSION); +#ifdef HAVE_LIBSYSTEMD_DAEMON + // Notify systemd about the same + sd_notifyf(0, "READY=1\n" + "STATUS=Dispatching packets...\n" + "MAINPID=%lu", + (unsigned long) getpid()); +#endif // And run the main loop of the server. ret = server.run(); diff --git a/src/bin/dhcp4/meson.build b/src/bin/dhcp4/meson.build index 3dac320..e8cacb9 100644 --- a/src/bin/dhcp4/meson.build +++ b/src/bin/dhcp4/meson.build @@ -1,3 +1,8 @@ +kea_dhcp4_dependencies = [CRYPTO_DEP] +if SYSTEMD_DEP.found() + kea_dhcp4_dependencies += [SYSTEMD_DEP] +endif + dhcp4_lib = static_library( 'dhcp4', 'client_handler.cc', @@ -16,7 +21,7 @@ dhcp4_lib = static_library( kea_dhcp4 = executable( 'kea-dhcp4', 'main.cc', - dependencies: [CRYPTO_DEP], + dependencies: kea_dhcp4_dependencies, include_directories: [include_directories('.')] + INCLUDES, install: true, install_dir: SBINDIR, diff --git a/src/bin/dhcp6/main.cc b/src/bin/dhcp6/main.cc index 7ab1999..abac799 100644 --- a/src/bin/dhcp6/main.cc +++ b/src/bin/dhcp6/main.cc @@ -24,6 +24,10 @@ #include +#ifdef HAVE_LIBSYSTEMD_DAEMON +#include +#endif + using namespace isc::data; using namespace isc::dhcp; using namespace isc::process; @@ -290,6 +294,13 @@ main(int argc, char* argv[]) { // Tell the admin we are ready to process packets LOG_INFO(dhcp6_logger, DHCP6_STARTED).arg(VERSION); +#ifdef HAVE_LIBSYSTEMD_DAEMON + // Notify systemd about the same + sd_notifyf(0, "READY=1\n" + "STATUS=Dispatching packets...\n" + "MAINPID=%lu", + (unsigned long) getpid()); +#endif // And run the main loop of the server. ret = server.run(); diff --git a/src/bin/dhcp6/meson.build b/src/bin/dhcp6/meson.build index de60fbf..04a22a9 100644 --- a/src/bin/dhcp6/meson.build +++ b/src/bin/dhcp6/meson.build @@ -1,3 +1,8 @@ +kea_dhcp6_dependencies = [CRYPTO_DEP] +if SYSTEMD_DEP.found() + kea_dhcp6_dependencies += [SYSTEMD_DEP] +endif + dhcp6_lib = static_library( 'dhcp6', 'client_handler.cc', @@ -17,7 +22,7 @@ dhcp6_lib = static_library( kea_dhcp6 = executable( 'kea-dhcp6', 'main.cc', - dependencies: [CRYPTO_DEP], + dependencies: kea_dhcp6_dependencies, include_directories: [include_directories('.')] + INCLUDES, install: true, install_dir: SBINDIR,