Commit bfcfc9ca authored by Shawn Routhier's avatar Shawn Routhier

[v4_1_esv] Add configure option to incude PID in syslog entries

parent 51406f4b
......@@ -118,6 +118,12 @@ by Eric Young (eay@cryptsoft.com).
Thanks to Tomas Hozza at Red Hat for the suggestion and a prototype fix.
[ISC-Bugs #33098]
- 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.1-ESV-R9rc1
- None
......
......@@ -138,7 +138,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));
......
......@@ -745,6 +745,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
......@@ -1410,6 +1411,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]
......@@ -5391,6 +5393,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"
......
......@@ -182,6 +182,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"
......
......@@ -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",
......
......@@ -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
......
......@@ -1357,6 +1357,13 @@ typedef unsigned char option_mask [16];
* Used to silence static analysers warnings about unused results.
*/
#define POST(x) ((void)(x))
#endif
#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 */
......
......@@ -188,7 +188,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));
......
......@@ -299,7 +299,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")) {
......@@ -1064,7 +1064,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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment