summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Markwalder <tmark@isc.org>2017-12-19 14:08:37 -0500
committerThomas Markwalder <tmark@isc.org>2017-12-19 14:08:37 -0500
commit423c987f63888fd73b331ee75280a3068361edc6 (patch)
tree3022544e690582137754fcfa6368c4b93ed8e15e
parent759d380c34bf356b92f787bda59bec8090c4236c (diff)
downloadisc-dhcp-423c987f63888fd73b331ee75280a3068361edc6.tar.gz
[46859] Addressed review comments
server/dhcpd.c renamed no_dhcpd_* variables to have_dhcpd_* so they are named for how they're actually used instead. modified to only call realpath() if the lease db has been specified by -lf or env variable. This makes it not necessary to have a value before reading the configuration file. server/dhcpd.conf.5 Updated the man pages.
-rw-r--r--server/dhcpd.c28
-rw-r--r--server/dhcpd.conf.513
2 files changed, 15 insertions, 26 deletions
diff --git a/server/dhcpd.c b/server/dhcpd.c
index 3ca9db4c..271bdb72 100644
--- a/server/dhcpd.c
+++ b/server/dhcpd.c
@@ -267,9 +267,9 @@ main(int argc, char **argv) {
struct parse *parse;
int lose;
#endif
- 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;
#ifdef DHCP4o6
@@ -460,17 +460,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")) {
@@ -566,20 +566,20 @@ main(int argc, char **argv) {
}
#endif /* DHCPv6 && DHCP4o6 */
- 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
@@ -588,11 +588,13 @@ main(int argc, char **argv) {
} else
#endif /* DHCPv6 */
{
- if (!no_dhcpd_db && (s = getenv ("PATH_DHCPD_DB"))) {
+ if (!have_dhcpd_db && (s = getenv ("PATH_DHCPD_DB"))) {
path_dhcpd_db = s;
+ have_dhcpd_db = 1;
}
- if (!no_dhcpd_pid && (s = getenv ("PATH_DHCPD_PID"))) {
+ if (!have_dhcpd_pid && (s = getenv ("PATH_DHCPD_PID"))) {
path_dhcpd_pid = s;
+ have_dhcpd_pid = 1;
}
}
@@ -600,7 +602,7 @@ main(int argc, char **argv) {
* 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] != '/') {
const char *path = path_dhcpd_db;
path_dhcpd_db = realpath(path_dhcpd_db, NULL);
if (path_dhcpd_db == NULL)
@@ -790,7 +792,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 f7a830b7..bd3218a7 100644
--- a/server/dhcpd.conf.5
+++ b/server/dhcpd.conf.5
@@ -2643,12 +2643,6 @@ is:
1. \fBlease-file-name\fR
2. \fB-lf\fR flag
3. \fBPATH_DHCPD_DB\fR environment variable.
-.PP
-Please note, the server requires the path to your lease file prior to
-processing your configuration file. Therefore, when using lease-file-name
-you must specify the path through either \fB-lf\fR or \fBPATH_DHCPD_DB\fR.
-For example, if you set lease-file-name to "/usr/local/var/my.leases", then
-you must set either -lf or PATH_DHCPD_DB to "/usr/local/var".
.RE
.PP
The
@@ -2684,13 +2678,6 @@ for the lease file name is:
1. \fBdhcpv6-lease-file-name\fR
2. \fB-lf\fR flag
3. \fBPATH_DHCPD6_DB\fR environment variable.
-.PP
-Please note, the server requires the path to your lease file prior to
-processing your configuration file. Therefore, when using
-dhcpv6-lease-file-name you must specify the path through either \fB-lf\fR or
-\fBPATH_DHCPD6_DB\fR. For example, if you set dhcpv6-lease-file-name to
-"/usr/local/var/my6.leases", then you must set either -lf or PATH_DHCPD6_DB to
-"/usr/local/var".
.RE
.PP
The