Commit ab77c8b8 authored by Thomas Markwalder's avatar Thomas Markwalder
Browse files

[master] Restores use of env vars for lease and pid files

    Merges in rt46859.
parent a2a0f98c
...@@ -298,10 +298,10 @@ dhcp-users@lists.isc.org. ...@@ -298,10 +298,10 @@ dhcp-users@lists.isc.org.
- Added to the server (-6) a new statement, local-address6, which specifies - Added to the server (-6) a new statement, local-address6, which specifies
the source address of packets sent by the server. An additional flag, the source address of packets sent by the server. An additional flag,
bind-local-address6, disabled by default makes the service socket to bind-local-address6, disabled by default, binds the service socket to
be bound to local-address6. Note as for local-address this does not to local-address6. Note that bind-local-address does not work with direct
work with direct client: a relay has to forward packets to the server clients: a relay has to forward packets to the server using the
using the local-address6 destination. local-address6 destination.
[ISC-Bugs #46084] [ISC-Bugs #46084]
Changes since 4.3.6 (Bugs): Changes since 4.3.6 (Bugs):
...@@ -338,6 +338,14 @@ dhcp-users@lists.isc.org. ...@@ -338,6 +338,14 @@ dhcp-users@lists.isc.org.
direction. direction.
[ISC-Bugs #46767] [ISC-Bugs #46767]
- 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.3.6b1 Changes since 4.3.6b1
- None - None
......
...@@ -271,9 +271,9 @@ main(int argc, char **argv) { ...@@ -271,9 +271,9 @@ main(int argc, char **argv) {
struct parse *parse; struct parse *parse;
int lose; int lose;
#endif #endif
int no_dhcpd_conf = 0; int have_dhcpd_conf = 0;
int no_dhcpd_db = 0; int have_dhcpd_db = 0;
int no_dhcpd_pid = 0; int have_dhcpd_pid = 0;
#ifdef DHCPv6 #ifdef DHCPv6
int local_family_set = 0; int local_family_set = 0;
#ifdef DHCP4o6 #ifdef DHCP4o6
...@@ -464,17 +464,17 @@ main(int argc, char **argv) { ...@@ -464,17 +464,17 @@ main(int argc, char **argv) {
if (++i == argc) if (++i == argc)
usage(use_noarg, argv[i-1]); usage(use_noarg, argv[i-1]);
path_dhcpd_conf = argv [i]; path_dhcpd_conf = argv [i];
no_dhcpd_conf = 1; have_dhcpd_conf = 1;
} else if (!strcmp (argv [i], "-lf")) { } else if (!strcmp (argv [i], "-lf")) {
if (++i == argc) if (++i == argc)
usage(use_noarg, argv[i-1]); usage(use_noarg, argv[i-1]);
path_dhcpd_db = argv [i]; path_dhcpd_db = argv [i];
no_dhcpd_db = 1; have_dhcpd_db = 1;
} else if (!strcmp (argv [i], "-pf")) { } else if (!strcmp (argv [i], "-pf")) {
if (++i == argc) if (++i == argc)
usage(use_noarg, argv[i-1]); usage(use_noarg, argv[i-1]);
path_dhcpd_pid = argv [i]; path_dhcpd_pid = argv [i];
no_dhcpd_pid = 1; have_dhcpd_pid = 1;
} else if (!strcmp(argv[i], "--no-pid")) { } else if (!strcmp(argv[i], "--no-pid")) {
no_pid_file = ISC_TRUE; no_pid_file = ISC_TRUE;
} else if (!strcmp (argv [i], "-t")) { } else if (!strcmp (argv [i], "-t")) {
...@@ -570,42 +570,43 @@ main(int argc, char **argv) { ...@@ -570,42 +570,43 @@ main(int argc, char **argv) {
} }
#endif /* DHCPv6 && DHCP4o6 */ #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; path_dhcpd_conf = s;
} }
#ifdef DHCPv6 #ifdef DHCPv6
if (local_family == AF_INET6) { if (local_family == AF_INET6) {
/* DHCPv6: override DHCPv4 lease and pid filenames */ /* DHCPv6: override DHCPv4 lease and pid filenames */
if (!no_dhcpd_db) { if (!have_dhcpd_db) {
if ((s = getenv ("PATH_DHCPD6_DB"))) if ((s = getenv ("PATH_DHCPD6_DB")))
path_dhcpd_db = s; path_dhcpd_db = s;
else else
path_dhcpd_db = _PATH_DHCPD6_DB; path_dhcpd_db = _PATH_DHCPD6_DB;
} }
if (!no_dhcpd_pid) { if (!have_dhcpd_pid) {
if ((s = getenv ("PATH_DHCPD6_PID"))) if ((s = getenv ("PATH_DHCPD6_PID")))
path_dhcpd_pid = s; path_dhcpd_pid = s;
else else
path_dhcpd_pid = _PATH_DHCPD6_PID; path_dhcpd_pid = _PATH_DHCPD6_PID;
} }
} else } 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; 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; path_dhcpd_pid = s;
have_dhcpd_pid = 1;
} }
} }
#endif /* DHCPv6 */
/* /*
* convert relative path names to absolute, for files that need * convert relative path names to absolute, for files that need
* to be reopened after chdir() has been called * 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; const char *path = path_dhcpd_db;
path_dhcpd_db = realpath(path_dhcpd_db, NULL); path_dhcpd_db = realpath(path_dhcpd_db, NULL);
if (path_dhcpd_db == NULL) if (path_dhcpd_db == NULL)
...@@ -795,7 +796,7 @@ main(int argc, char **argv) { ...@@ -795,7 +796,7 @@ main(int argc, char **argv) {
#if defined (TRACING) #if defined (TRACING)
if (traceinfile) { if (traceinfile) {
if (!no_dhcpd_db) { if (!have_dhcpd_db) {
log_error ("%s", ""); log_error ("%s", "");
log_error ("** You must specify a lease file with -lf."); log_error ("** You must specify a lease file with -lf.");
log_error (" Dhcpd will not overwrite your default"); log_error (" Dhcpd will not overwrite your default");
......
...@@ -2633,31 +2633,16 @@ statement ...@@ -2633,31 +2633,16 @@ statement
.B lease-file-name \fIname\fB;\fR .B lease-file-name \fIname\fB;\fR
.PP .PP
.I Name .I Name
should be the name of the DHCP server's lease file. By default, this Where \fIname\fR is the name of the DHCP server's lease file. By default,
is DBDIR/dhcpd.leases. This statement \fBmust\fR appear in the outer 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, scope of the configuration file - if it appears in some other scope, it will
it will have no effect. Furthermore, it has no effect if overridden have no effect. The value must be the absolute path of the file to use.
by the The order of precedence the server uses for the lease file name
.B -lf is:
flag or the
.B PATH_DHCPD_DB
environment variable.
.RE
.PP
The
.I limit-addrs-per-ia
statement
.RS 0.25i
.PP .PP
.B limit-addrs-per-ia \fInumber\fB;\fR 1. \fBlease-file-name\fR configuration file statement.
.PP 2. \fB-lf\fR command line flag.
By default, the DHCPv6 server will limit clients to one IAADDR per IA 3. \fBPATH_DHCPD_DB\fR environment variable.
option, meaning one address. If you wish to permit clients to hang onto
multiple addresses at a time, configure a larger \fInumber\fR here.
.PP
Note that there is no present method to configure the server to forcibly
configure the client with one IP address per each subnet on a shared network.
This is left to future work.
.RE .RE
.PP .PP
The The
...@@ -2667,21 +2652,16 @@ statement ...@@ -2667,21 +2652,16 @@ statement
.PP .PP
.B dhcpv6-lease-file-name \fIname\fB;\fR .B dhcpv6-lease-file-name \fIname\fB;\fR
.PP .PP
.I Name Where \fIname\fR is the name of the DHCP server's lease file when the server
is the name of the lease file to use if and only if the server is running is running DHCPv6. By default, this is DBDIR/dhcpd6.leases. This statement
in DHCPv6 mode. By default, this is DBDIR/dhcpd6.leases. This statement, \fBmust\fR appear in the outer scope of the configuration file - if it appears
like in some other scope, it will have no effect. The value must be the absolute
.I lease-file-name, path of the file to use. The order of precedence the server uses
\fBmust\fR appear in the outer scope of the configuration file. It for the lease file name is:
has no effect if overridden by the .PP
.B -lf 1. \fBdhcpv6-lease-file-name\fR configuration file statement.
flag or the 2. \fB-lf\fR command line flag.
.B PATH_DHCPD6_DB 3. \fBPATH_DHCPD6_DB\fR environment variable.
environment variable. If
.I dhcpv6-lease-file-name
is not specified, but
.I lease-file-name
is, the latter value will be used.
.RE .RE
.PP .PP
The The
...@@ -2705,6 +2685,22 @@ automatically reads the values in either format. ...@@ -2705,6 +2685,22 @@ automatically reads the values in either format.
.RE .RE
.PP .PP
The The
.I limit-addrs-per-ia
statement
.RS 0.25i
.PP
.B limit-addrs-per-ia \fInumber\fB;\fR
.PP
By default, the DHCPv6 server will limit clients to one IAADDR per IA
option, meaning one address. If you wish to permit clients to hang onto
multiple addresses at a time, configure a larger \fInumber\fR here.
.PP
Note that there is no present method to configure the server to forcibly
configure the client with one IP address per each subnet on a shared network.
This is left to future work.
.RE
.PP
The
.I local-port .I local-port
statement statement
.RS 0.25i .RS 0.25i
...@@ -2970,14 +2966,13 @@ statement ...@@ -2970,14 +2966,13 @@ statement
.I Name .I Name
should be the name of the DHCP server's process ID file. This is the 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 file in which the DHCP server's process ID is stored when the server
starts. By default, this is RUNDIR/dhcpd.pid. Like the starts. By default, this is RUNDIR/dhcpd.pid. Like the \fIlease-file-name\fR
.I lease-file-name statement, this statement must appear in the outer scope of the configuration
statement, this statement must appear in the outer scope file. The order of precedence used by the server is:
of the configuration file. It has no effect if overridden by the .PP
.B -pf 1. \fBpid-file-name\fR configuration file statement.
flag or the 2. \fB-lf\fR command line flag.
.B PATH_DHCPD_PID 3. \fBPATH_DHCPD_PID\fR environment variable.
environment variable.
.PP .PP
The The
.I dhcpv6-pid-file-name .I dhcpv6-pid-file-name
...@@ -2989,18 +2984,13 @@ statement ...@@ -2989,18 +2984,13 @@ statement
.I Name .I Name
is the name of the pid file to use if and only if the server is running 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, in DHCPv6 mode. By default, this is DBDIR/dhcpd6.pid. This statement,
like like \fIpid-file-name\fr, \fBmust\fR appear in the outer scope of the
.I pid-file-name, configuration file. The order of precedence used by the server is:
\fBmust\fR appear in the outer scope of the configuration file. It .PP
has no effect if overridden by the 1. \fBdhcpv6-pid-file-name\fR configuration file statement.
.B -pf 2. \fB-lf\fR command line flag.
flag or the 3. \fBPATH_DHCPD6_PID\fR environment variable.
.B PATH_DHCPD6_PID .PP
environment variable. If
.I dhcpv6-pid-file-name
is not specified, but
.I pid-file-name
is, the latter value will be used.
.RE .RE
.PP .PP
The The
......
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