summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Routhier <sar@isc.org>2014-05-07 12:19:33 -0700
committerShawn Routhier <sar@isc.org>2014-05-07 12:19:33 -0700
commit00e9af8ee0d724e5dc6d15c43d8f602909981d66 (patch)
tree744a0fc908b52d45b7ed0941afdb61e4735526b2
parentd8c7c34ef64922f1b7d60c5bd5ac01d8ad5ffdca (diff)
downloadisc-dhcp-00e9af8ee0d724e5dc6d15c43d8f602909981d66.tar.gz
[master] Add configure option to incude PID in syslog entries
-rw-r--r--RELNOTES6
-rw-r--r--client/dhclient.c2
-rwxr-xr-xconfigure16
-rw-r--r--configure.ac10
-rw-r--r--dhcpctl/omshell.c2
-rw-r--r--includes/config.h.in3
-rw-r--r--includes/dhcpd.h6
-rw-r--r--relay/dhcrelay.c2
-rw-r--r--server/dhcpd.c4
9 files changed, 46 insertions, 5 deletions
diff --git a/RELNOTES b/RELNOTES
index 938a819c..62cab0e3 100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -133,6 +133,12 @@ by Eric Young (eay@cryptsoft.com).
When processing a "--version" request don't output the version information
to syslog.
+- Add the "enable-log-pid" option to the configure script. When enabled
+ this causes the client, server and relay programs to include the PID
+ number in syslog messages.
+ Thanks to Marius Tomaschewski for the suggestion and proto-patch.
+ [ISC-Bugs #29713]
+
Changes since 4.3.0rc1
- None
diff --git a/client/dhclient.c b/client/dhclient.c
index 0e123371..fbafe13a 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -140,7 +140,7 @@ main(int argc, char **argv) {
else if (fd != -1)
close(fd);
- openlog("dhclient", LOG_NDELAY, LOG_DAEMON);
+ openlog("dhclient", DHCP_LOG_OPTIONS, LOG_DAEMON);
#if !(defined(DEBUG) || defined(__CYGWIN32__))
setlogmask(LOG_UPTO(LOG_INFO));
diff --git a/configure b/configure
index a0e69694..b41aeb4f 100755
--- a/configure
+++ b/configure
@@ -746,6 +746,7 @@ enable_early_chroot
enable_ipv4_pktinfo
enable_use_sockets
enable_secs_byteorder
+enable_log_pid
with_atf
with_srv_lease_file
with_srv6_lease_file
@@ -1414,6 +1415,7 @@ Optional Features:
--enable-use-sockets use the standard BSD socket API (default is no)
--enable-secs-byteorder Correct bad byteorders in the secs field (default is
no).
+ --enable-log-pid Include PIDs in syslog messages (default is no).
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -5400,6 +5402,20 @@ $as_echo "#define SECS_BYTEORDER 1" >>confdefs.h
fi
+# Include the PID in the log messages. This is useful when there may be multiple
+# instances of a program.
+# This is off by default
+# Check whether --enable-log_pid was given.
+if test "${enable_log_pid+set}" = set; then :
+ enableval=$enable_log_pid;
+fi
+
+if test "$enable_log_pid" = "yes" ; then
+
+$as_echo "#define USE_LOG_PID 1" >>confdefs.h
+
+fi
+
# Testing section
atf_path="no"
diff --git a/configure.ac b/configure.ac
index a14366d6..5a41407f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -171,6 +171,16 @@ if test "$enable_secs_byteorder" = "yes" ; then
[Define to correct bad byteorders in secs field.])
fi
+# Include the PID in the log messages. This is useful when there may
+# be multiple instances of a program.
+# This is off by default
+AC_ARG_ENABLE(log_pid,
+ AS_HELP_STRING([--enable-log-pid],[Include PIDs in syslog messages (default is no).]))
+if test "$enable_log_pid" = "yes" ; then
+ AC_DEFINE([USE_LOG_PID], [1],
+ [Define to include PIDs in syslog messages.])
+fi
+
# Testing section
atf_path="no"
diff --git a/dhcpctl/omshell.c b/dhcpctl/omshell.c
index 47e5d0be..44fd2726 100644
--- a/dhcpctl/omshell.c
+++ b/dhcpctl/omshell.c
@@ -100,7 +100,7 @@ main(int argc, char **argv) {
}
/* Initially, log errors to stderr as well as to syslogd. */
- openlog ("omshell", LOG_NDELAY, DHCPD_LOG_FACILITY);
+ openlog ("omshell", DHCP_LOG_OPTIONS, DHCPD_LOG_FACILITY);
status = dhcpctl_initialize ();
if (status != ISC_R_SUCCESS) {
fprintf (stderr, "dhcpctl_initialize: %s\n",
diff --git a/includes/config.h.in b/includes/config.h.in
index a93a2d47..3124b85c 100644
--- a/includes/config.h.in
+++ b/includes/config.h.in
@@ -148,6 +148,9 @@
/* Define to include server activity tracing support. */
#undef TRACING
+/* Define to include PIDs in syslog messages. */
+#undef USE_LOG_PID
+
/* Define to 1 to use the standard BSD socket API. */
#undef USE_SOCKETS
diff --git a/includes/dhcpd.h b/includes/dhcpd.h
index da25a7f9..7eb7980e 100644
--- a/includes/dhcpd.h
+++ b/includes/dhcpd.h
@@ -1484,6 +1484,12 @@ typedef unsigned char option_mask [16];
#define MAX_TIME 0x7fffffff
#define MIN_TIME 0
+#ifdef USE_LOG_PID
+/* include the pid in the syslog messages */
+#define DHCP_LOG_OPTIONS LOG_NDELAY | LOG_PID
+#else
+#define DHCP_LOG_OPTIONS LOG_NDELAY
+#endif
/* these are referenced */
typedef struct hash_table ia_hash_t;
typedef struct hash_table iasubopt_hash_t;
diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c
index 11751d21..115fbd45 100644
--- a/relay/dhcrelay.c
+++ b/relay/dhcrelay.c
@@ -197,7 +197,7 @@ main(int argc, char **argv) {
else if (fd != -1)
close(fd);
- openlog("dhcrelay", LOG_NDELAY, LOG_DAEMON);
+ openlog("dhcrelay", DHCP_LOG_OPTIONS, LOG_DAEMON);
#if !defined(DEBUG)
setlogmask(LOG_UPTO(LOG_INFO));
diff --git a/server/dhcpd.c b/server/dhcpd.c
index bd9e1efb..1f2d774f 100644
--- a/server/dhcpd.c
+++ b/server/dhcpd.c
@@ -220,7 +220,7 @@ main(int argc, char **argv) {
dhcp_common_objects_setup ();
/* Initially, log errors to stderr as well as to syslogd. */
- openlog ("dhcpd", LOG_NDELAY, DHCPD_LOG_FACILITY);
+ openlog ("dhcpd", DHCP_LOG_OPTIONS, DHCPD_LOG_FACILITY);
for (i = 1; i < argc; i++) {
if (!strcmp (argv [i], "-p")) {
@@ -1021,7 +1021,7 @@ void postconf_initialization (int quiet)
&global_scope, oc, MDL)) {
if (db.len == 1) {
closelog ();
- openlog("dhcpd", LOG_NDELAY, db.data[0]);
+ openlog("dhcpd", DHCP_LOG_OPTIONS, db.data[0]);
/* Log the startup banner into the new
log file. */
if (!quiet) {