2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-31 22:35:25 +00:00

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

This commit is contained in:
Shawn Routhier
2014-05-07 12:19:33 -07:00
parent d8c7c34ef6
commit 00e9af8ee0
9 changed files with 46 additions and 5 deletions

View File

@@ -133,6 +133,12 @@ by Eric Young (eay@cryptsoft.com).
When processing a "--version" request don't output the version information When processing a "--version" request don't output the version information
to syslog. 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 Changes since 4.3.0rc1
- None - None

View File

@@ -140,7 +140,7 @@ main(int argc, char **argv) {
else if (fd != -1) else if (fd != -1)
close(fd); close(fd);
openlog("dhclient", LOG_NDELAY, LOG_DAEMON); openlog("dhclient", DHCP_LOG_OPTIONS, LOG_DAEMON);
#if !(defined(DEBUG) || defined(__CYGWIN32__)) #if !(defined(DEBUG) || defined(__CYGWIN32__))
setlogmask(LOG_UPTO(LOG_INFO)); setlogmask(LOG_UPTO(LOG_INFO));

16
configure vendored
View File

@@ -746,6 +746,7 @@ enable_early_chroot
enable_ipv4_pktinfo enable_ipv4_pktinfo
enable_use_sockets enable_use_sockets
enable_secs_byteorder enable_secs_byteorder
enable_log_pid
with_atf with_atf
with_srv_lease_file with_srv_lease_file
with_srv6_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-use-sockets use the standard BSD socket API (default is no)
--enable-secs-byteorder Correct bad byteorders in the secs field (default is --enable-secs-byteorder Correct bad byteorders in the secs field (default is
no). no).
--enable-log-pid Include PIDs in syslog messages (default is no).
Optional Packages: Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -5400,6 +5402,20 @@ $as_echo "#define SECS_BYTEORDER 1" >>confdefs.h
fi 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 # Testing section
atf_path="no" atf_path="no"

View File

@@ -171,6 +171,16 @@ if test "$enable_secs_byteorder" = "yes" ; then
[Define to correct bad byteorders in secs field.]) [Define to correct bad byteorders in secs field.])
fi 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 # Testing section
atf_path="no" atf_path="no"

View File

@@ -100,7 +100,7 @@ main(int argc, char **argv) {
} }
/* Initially, log errors to stderr as well as to syslogd. */ /* 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 (); status = dhcpctl_initialize ();
if (status != ISC_R_SUCCESS) { if (status != ISC_R_SUCCESS) {
fprintf (stderr, "dhcpctl_initialize: %s\n", fprintf (stderr, "dhcpctl_initialize: %s\n",

View File

@@ -148,6 +148,9 @@
/* Define to include server activity tracing support. */ /* Define to include server activity tracing support. */
#undef TRACING #undef TRACING
/* Define to include PIDs in syslog messages. */
#undef USE_LOG_PID
/* Define to 1 to use the standard BSD socket API. */ /* Define to 1 to use the standard BSD socket API. */
#undef USE_SOCKETS #undef USE_SOCKETS

View File

@@ -1484,6 +1484,12 @@ typedef unsigned char option_mask [16];
#define MAX_TIME 0x7fffffff #define MAX_TIME 0x7fffffff
#define MIN_TIME 0 #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 */ /* these are referenced */
typedef struct hash_table ia_hash_t; typedef struct hash_table ia_hash_t;
typedef struct hash_table iasubopt_hash_t; typedef struct hash_table iasubopt_hash_t;

View File

@@ -197,7 +197,7 @@ main(int argc, char **argv) {
else if (fd != -1) else if (fd != -1)
close(fd); close(fd);
openlog("dhcrelay", LOG_NDELAY, LOG_DAEMON); openlog("dhcrelay", DHCP_LOG_OPTIONS, LOG_DAEMON);
#if !defined(DEBUG) #if !defined(DEBUG)
setlogmask(LOG_UPTO(LOG_INFO)); setlogmask(LOG_UPTO(LOG_INFO));

View File

@@ -220,7 +220,7 @@ main(int argc, char **argv) {
dhcp_common_objects_setup (); dhcp_common_objects_setup ();
/* Initially, log errors to stderr as well as to syslogd. */ /* 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++) { for (i = 1; i < argc; i++) {
if (!strcmp (argv [i], "-p")) { if (!strcmp (argv [i], "-p")) {
@@ -1021,7 +1021,7 @@ void postconf_initialization (int quiet)
&global_scope, oc, MDL)) { &global_scope, oc, MDL)) {
if (db.len == 1) { if (db.len == 1) {
closelog (); closelog ();
openlog("dhcpd", LOG_NDELAY, db.data[0]); openlog("dhcpd", DHCP_LOG_OPTIONS, db.data[0]);
/* Log the startup banner into the new /* Log the startup banner into the new
log file. */ log file. */
if (!quiet) { if (!quiet) {