summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Markwalder <tmark@isc.org>2019-06-20 10:17:31 -0400
committerThomas Markwalder <tmark@isc.org>2019-06-20 10:17:31 -0400
commit3024e99df64582ec34173724d302240d3fb9e7aa (patch)
tree7b2035c5d0fec8ac22049853036447a8c48d6f5b
parent3a4476be4e24c6b1a61515542b40364d22dd82f8 (diff)
downloadisc-dhcp-3024e99df64582ec34173724d302240d3fb9e7aa.tar.gz
[v4_1_esv] Restores use of env vars for lease and pid files
Merges in rt46859
-rw-r--r--RELNOTES8
-rw-r--r--server/dhcpd.c29
-rw-r--r--server/dhcpd.conf.598
3 files changed, 66 insertions, 69 deletions
diff --git a/RELNOTES b/RELNOTES
index 9fd6c005..fcade4c6 100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -92,6 +92,14 @@ dhcp-users@lists.isc.org.
completion of the test.
[ISC-Bugs #22267]
+- The server now recognizes environment variables PATH_DHCPD_DB and
+ PATH_DHCPD_PID. These had been incorrectly compiled out of the code
+ unless DHCPv6 support was disabled. Additionally, the server man
+ pages were corrected to accurately reflect how the server chooses
+ file names (see lease-file-name and pid-file-name statements). Thanks
+ to Fernando Soto at Bluecat for bringing this matter to our attention.
+ [ISC-Bugs #46859]
+
Changes since 4.1-ESV-R15b1
- None
diff --git a/server/dhcpd.c b/server/dhcpd.c
index b5189ce3..5e593593 100644
--- a/server/dhcpd.c
+++ b/server/dhcpd.c
@@ -300,9 +300,9 @@ main(int argc, char **argv) {
struct interface_info *ip;
struct parse *parse;
int lose;
- int no_dhcpd_conf = 0;
- int no_dhcpd_db = 0;
- int no_dhcpd_pid = 0;
+ int have_dhcpd_conf = 0;
+ int have_dhcpd_db = 0;
+ int have_dhcpd_pid = 0;
#ifdef DHCPv6
int local_family_set = 0;
#endif /* DHCPv6 */
@@ -401,17 +401,17 @@ main(int argc, char **argv) {
if (++i == argc)
usage(use_noarg, argv[i-1]);
path_dhcpd_conf = argv [i];
- no_dhcpd_conf = 1;
+ have_dhcpd_conf = 1;
} else if (!strcmp (argv [i], "-lf")) {
if (++i == argc)
usage(use_noarg, argv[i-1]);
path_dhcpd_db = argv [i];
- no_dhcpd_db = 1;
+ have_dhcpd_db = 1;
} else if (!strcmp (argv [i], "-pf")) {
if (++i == argc)
usage(use_noarg, argv[i-1]);
path_dhcpd_pid = argv [i];
- no_dhcpd_pid = 1;
+ have_dhcpd_pid = 1;
} else if (!strcmp(argv[i], "--no-pid")) {
no_pid_file = ISC_TRUE;
} else if (!strcmp (argv [i], "-t")) {
@@ -487,42 +487,41 @@ main(int argc, char **argv) {
}
}
- if (!no_dhcpd_conf && (s = getenv ("PATH_DHCPD_CONF"))) {
+ if (!have_dhcpd_conf && (s = getenv ("PATH_DHCPD_CONF"))) {
path_dhcpd_conf = s;
}
#ifdef DHCPv6
if (local_family == AF_INET6) {
/* DHCPv6: override DHCPv4 lease and pid filenames */
- if (!no_dhcpd_db) {
+ if (!have_dhcpd_db) {
if ((s = getenv ("PATH_DHCPD6_DB")))
path_dhcpd_db = s;
else
path_dhcpd_db = _PATH_DHCPD6_DB;
}
- if (!no_dhcpd_pid) {
+ if (!have_dhcpd_pid) {
if ((s = getenv ("PATH_DHCPD6_PID")))
path_dhcpd_pid = s;
else
path_dhcpd_pid = _PATH_DHCPD6_PID;
}
} else
-#else /* !DHCPv6 */
+#endif /* DHCPv6 */
{
- if (!no_dhcpd_db && (s = getenv ("PATH_DHCPD_DB"))) {
+ if (!have_dhcpd_db && (s = getenv ("PATH_DHCPD_DB"))) {
path_dhcpd_db = s;
}
- if (!no_dhcpd_pid && (s = getenv ("PATH_DHCPD_PID"))) {
+ if (!have_dhcpd_pid && (s = getenv ("PATH_DHCPD_PID"))) {
path_dhcpd_pid = s;
}
}
-#endif /* DHCPv6 */
/*
* convert relative path names to absolute, for files that need
* to be reopened after chdir() has been called
*/
- if (path_dhcpd_db[0] != '/') {
+ if (have_dhcpd_db && path_dhcpd_db[0] != '/') {
char *path = dmalloc(PATH_MAX, MDL);
if (path == NULL)
log_fatal("No memory for filename\n");
@@ -702,7 +701,7 @@ main(int argc, char **argv) {
#if defined (TRACING)
if (traceinfile) {
- if (!no_dhcpd_db) {
+ if (!have_dhcpd_db) {
log_error ("%s", "");
log_error ("** You must specify a lease file with -lf.");
log_error (" Dhcpd will not overwrite your default");
diff --git a/server/dhcpd.conf.5 b/server/dhcpd.conf.5
index 50d1263a..2c4d78dd 100644
--- a/server/dhcpd.conf.5
+++ b/server/dhcpd.conf.5
@@ -1,6 +1,6 @@
.\" dhcpd.conf.5
.\"
-.\" Copyright (c) 2004-2016 by Internet Systems Consortium, Inc. ("ISC")
+.\" Copyright (c) 2004-2017 by Internet Systems Consortium, Inc. ("ISC")
.\" Copyright (c) 1996-2003 by Internet Software Consortium
.\"
.\" Permission to use, copy, modify, and distribute this software for any
@@ -2383,15 +2383,35 @@ statement
.B lease-file-name \fIname\fB;\fR
.PP
.I Name
-should be the name of the DHCP server's lease file. By default, this
-is DBDIR/dhcpd.leases. This statement \fBmust\fR appear in the outer
-scope of the configuration file - if it appears in some other scope,
-it will have no effect. Furthermore, it has no effect if overridden
-by the
-.B -lf
-flag or the
-.B PATH_DHCPD_DB
-environment variable.
+Where \fIname\fR is the name of the DHCP server's lease file. By default,
+this is DBDIR/dhcpd.leases. This statement \fBmust\fR appear in the outer
+scope of the configuration file - if it appears in some other scope, it will
+have no effect. The value must be the absolute path of the file to use.
+The order of precedence the server uses for the lease file name
+is:
+.PP
+ 1. \fBlease-file-name\fR configuration file statement.
+ 2. \fB-lf\fR command line flag.
+ 3. \fBPATH_DHCPD_DB\fR environment variable.
+.RE
+.PP
+The
+.I dhcpv6-lease-file-name
+statement
+.RS 0.25i
+.PP
+.B dhcpv6-lease-file-name \fIname\fB;\fR
+.PP
+Where \fIname\fR is the name of the DHCP server's lease file when the server
+is running DHCPv6. By default, this is DBDIR/dhcpd6.leases. This statement
+\fBmust\fR appear in the outer scope of the configuration file - if it appears
+in some other scope, it will have no effect. The value must be the absolute
+path of the file to use. The order of precedence the server uses
+for the lease file name is:
+.PP
+ 1. \fBdhcpv6-lease-file-name\fR configuration file statement.
+ 2. \fB-lf\fR command line flag.
+ 3. \fBPATH_DHCPD6_DB\fR environment variable.
.RE
.PP
The
@@ -2411,30 +2431,6 @@ This is left to future work.
.RE
.PP
The
-.I dhcpv6-lease-file-name
-statement
-.RS 0.25i
-.PP
-.B dhcpv6-lease-file-name \fIname\fB;\fR
-.PP
-.I Name
-is the name of the lease file to use if and only if the server is running
-in DHCPv6 mode. By default, this is DBDIR/dhcpd6.leases. This statement,
-like
-.I lease-file-name,
-\fBmust\fR appear in the outer scope of the configuration file. It
-has no effect if overridden by the
-.B -lf
-flag or the
-.B PATH_DHCPD6_DB
-environment variable. If
-.I dhcpv6-lease-file-name
-is not specified, but
-.I lease-file-name
-is, the latter value will be used.
-.RE
-.PP
-The
.I local-port
statement
.RS 0.25i
@@ -2627,14 +2623,14 @@ statement
.I Name
should be the name of the DHCP server's process ID file. This is the
file in which the DHCP server's process ID is stored when the server
-starts. By default, this is RUNDIR/dhcpd.pid. Like the
-.I lease-file-name
-statement, this statement must appear in the outer scope
-of the configuration file. It has no effect if overridden by the
-.B -pf
-flag or the
-.B PATH_DHCPD_PID
-environment variable.
+starts. By default, this is RUNDIR/dhcpd.pid. Like the \fIlease-file-name\fR
+statement, this statement must appear in the outer scope of the configuration
+file. The order of precedence used by the server is:
+.PP
+ 1. \fBpid-file-name\fR configuration file statement.
+ 2. \fB-lf\fR command line flag.
+ 3. \fBPATH_DHCPD_PID\fR environment variable.
+.RE
.PP
The
.I dhcpv6-pid-file-name
@@ -2646,18 +2642,12 @@ statement
.I Name
is the name of the pid file to use if and only if the server is running
in DHCPv6 mode. By default, this is DBDIR/dhcpd6.pid. This statement,
-like
-.I pid-file-name,
-\fBmust\fR appear in the outer scope of the configuration file. It
-has no effect if overridden by the
-.B -pf
-flag or the
-.B PATH_DHCPD6_PID
-environment variable. If
-.I dhcpv6-pid-file-name
-is not specified, but
-.I pid-file-name
-is, the latter value will be used.
+like \fIpid-file-name\fr, \fBmust\fR appear in the outer scope of the
+configuration file. The order of precedence used by the server is:
+.PP
+ 1. \fBdhcpv6-pid-file-name\fR configuration file statement.
+ 2. \fB-lf\fR command line flag.
+ 3. \fBPATH_DHCPD6_PID\fR environment variable.
.RE
.PP
The