]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
[master] Add configure option to incude PID in syslog entries
authorShawn Routhier <sar@isc.org>
Wed, 7 May 2014 19:19:33 +0000 (12:19 -0700)
committerShawn Routhier <sar@isc.org>
Wed, 7 May 2014 19:19:33 +0000 (12:19 -0700)
RELNOTES
client/dhclient.c
configure
configure.ac
dhcpctl/omshell.c
includes/config.h.in
includes/dhcpd.h
relay/dhcrelay.c
server/dhcpd.c

index 938a819ca75d0da39f9bf340b58f33cbf7164108..62cab0e36a34f3df5edd6b4129db6b72a83287ea 100644 (file)
--- 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
index 0e1233714348fcef451e8f46fea3beb252cec59c..fbafe13a89b376db8a2f24abe9f80cbf85fffa0e 100644 (file)
@@ -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));
index a0e6969497abc7597377e5e6a50b0ee6d015b24c..b41aeb4f71fd457ff07db24734e4e355cff79f11 100755 (executable)
--- 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"
index a14366d615ec96f1faa006ad58d6ed285ab777ab..5a41407fbd7636842aa5a5bec8088f02470c9880 100644 (file)
@@ -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"
index 47e5d0bea0c8e5bd61954c00ba32233c2a84b344..44fd2726d6c07cb93fe72c907d8c00c29756ab4d 100644 (file)
@@ -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",
index a93a2d475f647d6edfc4562e42a70cbf75bd52fe..3124b85c0f4109acfdfeca19c019e9e38aca77fa 100644 (file)
 /* 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
 
index da25a7f9a3076c243ffc1ba08b27fcffe84bb749..7eb7980e4b7c501d1f6b8c49d7ed17611c2b1429 100644 (file)
@@ -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;
index 11751d212c75e7335897d77021b1329cd94be8f8..115fbd4576bed3d4595ece87acead49cc5a9c991 100644 (file)
@@ -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));
index bd9e1efbc57e3a5b67a13739c05c92b763770c01..1f2d774f7b6d96c88c5b21f94a2b5f073c48ead3 100644 (file)
@@ -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) {