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

Use different paths for PID and lease files when running in DHCPv4 or

DHCPv6 mode, so that servers for both protcols can be run simultaneously on
a single interface. [rt17227]
This commit is contained in:
Evan Hunt
2007-10-27 19:15:37 +00:00
parent 182b187ea5
commit 75135a3f7f
24 changed files with 242 additions and 14 deletions

View File

@@ -54,6 +54,10 @@ suggested fixes to <dhcp-users@isc.org>.
Changes since 4.0.0b1 Changes since 4.0.0b1
- Use different paths for PID and lease files when running in DHCPv4
or DHCPv6 mode, so that servers for both protcols can be run
simultaneously on a single interface.
- Fixed a buffer overflow error which could have allowed a denial - Fixed a buffer overflow error which could have allowed a denial
of service under unusual server configurations of service under unusual server configurations

View File

@@ -1,4 +1,4 @@
static const char rcsid[] = "$Header: /tmp/cvstest/DHCP/dst/dst_support.c,v 1.1 2001/02/22 07:22:08 mellon Exp $"; static const char rcsid[] = "$Header: /tmp/cvstest/DHCP/dst/dst_support.c,v 1.2 2007/10/27 19:15:32 each Exp $";
/* /*
@@ -155,7 +155,7 @@ dst_s_conv_bignum_b64_to_u8(const char **buf,
} }
bp = strchr(*buf, '\n'); /* find length of input line */ bp = strchr(*buf, '\n'); /* find length of input line */
if (bp != NULL) if (bp != NULL)
*bp = (u_char) NULL; *bp = '\0';
blen = b64_pton(*buf, bstr, sizeof(bstr)); blen = b64_pton(*buf, bstr, sizeof(bstr));
if (blen <= 0) { if (blen <= 0) {

View File

@@ -64,6 +64,9 @@ extern int h_errno;
#ifndef _PATH_DHCPD_PID #ifndef _PATH_DHCPD_PID
#define _PATH_DHCPD_PID "/etc/dhcpd.pid" #define _PATH_DHCPD_PID "/etc/dhcpd.pid"
#endif #endif
#ifndef _PATH_DHCPD6_PID
#define _PATH_DHCPD6_PID "/etc/dhcpd6.pid"
#endif
#ifndef _PATH_DHCLIENT_PID #ifndef _PATH_DHCLIENT_PID
#define _PATH_DHCLIENT_PID "/etc/dhclient.pid" #define _PATH_DHCLIENT_PID "/etc/dhclient.pid"
#endif #endif

View File

@@ -80,6 +80,9 @@ typedef unsigned long u_int64_t;
#ifndef _PATH_DHCPD_PID #ifndef _PATH_DHCPD_PID
#define _PATH_DHCPD_PID "/var/run/dhcpd.pid" #define _PATH_DHCPD_PID "/var/run/dhcpd.pid"
#endif #endif
#ifndef _PATH_DHCPD6_PID
#define _PATH_DHCPD6_PID "/var/run/dhcpd6.pid"
#endif
#ifndef _PATH_DHCLIENT_PID #ifndef _PATH_DHCLIENT_PID
#define _PATH_DHCLIENT_PID "/var/run/dhclient.pid" #define _PATH_DHCLIENT_PID "/var/run/dhclient.pid"
#endif #endif

View File

@@ -60,9 +60,15 @@ extern int h_errno;
#ifndef _PATH_DHCPD_PID #ifndef _PATH_DHCPD_PID
#define _PATH_DHCPD_PID "/var/run/dhcpd.pid" #define _PATH_DHCPD_PID "/var/run/dhcpd.pid"
#endif #endif
#ifndef _PATH_DHCPD6_PID
#define _PATH_DHCPD6_PID "/var/run/dhcpd6.pid"
#endif
#ifndef _PATH_DHCPD_DB #ifndef _PATH_DHCPD_DB
#define _PATH_DHCPD_DB "/var/db/dhcpd.leases" #define _PATH_DHCPD_DB "/var/db/dhcpd.leases"
#endif #endif
#ifndef _PATH_DHCPD6_DB
#define _PATH_DHCPD6_DB "/var/db/dhcpd6.leases"
#endif
#ifndef _PATH_DHCLIENT_PID #ifndef _PATH_DHCLIENT_PID
#define _PATH_DHCLIENT_PID "/var/run/dhclient.pid" #define _PATH_DHCLIENT_PID "/var/run/dhclient.pid"
#endif #endif

View File

@@ -75,9 +75,15 @@
#ifndef _PATH_DHCPD_PID #ifndef _PATH_DHCPD_PID
#define _PATH_DHCPD_PID "//e/etc/dhcpd.pid" #define _PATH_DHCPD_PID "//e/etc/dhcpd.pid"
#endif #endif
#ifndef _PATH_DHCPD6_PID
#define _PATH_DHCPD6_PID "//e/etc/dhcpd6.pid"
#endif
#ifndef _PATH_DHCPD_DB #ifndef _PATH_DHCPD_DB
#define _PATH_DHCPD_DB "//e/etc/dhcpd.leases" #define _PATH_DHCPD_DB "//e/etc/dhcpd.leases"
#endif #endif
#ifndef _PATH_DHCPD6_DB
#define _PATH_DHCPD6_DB "//e/etc/dhcpd6.leases"
#endif
#ifndef _PATH_DHCPD_CONF #ifndef _PATH_DHCPD_CONF
#define _PATH_DHCPD_CONF "//e/etc/dhcpd.conf" #define _PATH_DHCPD_CONF "//e/etc/dhcpd.conf"
#endif #endif

View File

@@ -67,9 +67,15 @@ extern int h_errno;
#ifndef _PATH_DHCPD_PID #ifndef _PATH_DHCPD_PID
#define _PATH_DHCPD_PID "/var/run/dhcpd.pid" #define _PATH_DHCPD_PID "/var/run/dhcpd.pid"
#endif #endif
#ifndef _PATH_DHCPD6_PID
#define _PATH_DHCPD6_PID "/var/run/dhcpd6.pid"
#endif
#ifndef _PATH_DHCPD_DB #ifndef _PATH_DHCPD_DB
#define _PATH_DHCPD_DB "/var/db/dhcpd.leases" #define _PATH_DHCPD_DB "/var/db/dhcpd.leases"
#endif #endif
#ifndef _PATH_DHCPD6_DB
#define _PATH_DHCPD6_DB "/var/db/dhcpd6.leases"
#endif
#ifndef _PATH_DHCLIENT_PID #ifndef _PATH_DHCLIENT_PID
#define _PATH_DHCLIENT_PID "/var/run/dhclient.pid" #define _PATH_DHCLIENT_PID "/var/run/dhclient.pid"
#endif #endif

View File

@@ -62,6 +62,9 @@ extern int h_errno;
#ifndef _PATH_DHCPD_PID #ifndef _PATH_DHCPD_PID
#define _PATH_DHCPD_PID "/etc/dhcpd.pid" #define _PATH_DHCPD_PID "/etc/dhcpd.pid"
#endif #endif
#ifndef _PATH_DHCPD6_PID
#define _PATH_DHCPD6_PID "/etc/dhcpd6.pid"
#endif
#ifndef _PATH_DHCLIENT_PID #ifndef _PATH_DHCLIENT_PID
#define _PATH_DHCLIENT_PID "/etc/dhclient.pid" #define _PATH_DHCLIENT_PID "/etc/dhclient.pid"
#endif #endif

View File

@@ -50,11 +50,19 @@ extern int h_errno;
#include <net/if_arp.h> #include <net/if_arp.h>
#define _PATH_DHCPD_CONF "/usr/local/etc/dhcpd.conf" #define _PATH_DHCPD_CONF "/usr/local/etc/dhcpd.conf"
#define _PATH_DHCPD_DB "/usr/local/etc/dhcp/dhcpd.leases"
#ifndef _PATH_DHCPD_DB
#define _PATH_DHCPD_DB "/usr/local/etc/dhcp/dhcpd.leases"
#endif
#ifndef _PATH_DHCPD6_DB
#define _PATH_DHCPD6_DB "/usr/local/etc/dhcp/dhcpd6.leases"
#endif
#ifndef _PATH_DHCPD_PID #ifndef _PATH_DHCPD_PID
#define _PATH_DHCPD_PID "/etc/dhcpd.pid" #define _PATH_DHCPD_PID "/etc/dhcpd.pid"
#endif #endif
#ifndef _PATH_DHCPD6_PID
#define _PATH_DHCPD6_PID "/etc/dhcpd6.pid"
#endif
#ifndef _PATH_DHCLIENT_PID #ifndef _PATH_DHCLIENT_PID
#define _PATH_DHCLIENT_PID "/etc/dhclient.pid" #define _PATH_DHCLIENT_PID "/etc/dhclient.pid"
#endif #endif

View File

@@ -85,6 +85,9 @@ extern int h_errno;
#ifndef _PATH_DHCPD_DB #ifndef _PATH_DHCPD_DB
#define _PATH_DHCPD_DB "/var/state/dhcp/dhcpd.leases" #define _PATH_DHCPD_DB "/var/state/dhcp/dhcpd.leases"
#endif #endif
#ifndef _PATH_DHCPD6_DB
#define _PATH_DHCPD6_DB "/var/state/dhcp/dhcpd6.leases"
#endif
#ifndef _PATH_DHCLIENT_DB #ifndef _PATH_DHCLIENT_DB
#define _PATH_DHCLIENT_DB "/var/state/dhcp/dhclient.leases" #define _PATH_DHCLIENT_DB "/var/state/dhcp/dhclient.leases"

View File

@@ -63,9 +63,15 @@ extern int h_errno;
#ifndef _PATH_DHCPD_PID #ifndef _PATH_DHCPD_PID
#define _PATH_DHCPD_PID "/var/run/dhcpd.pid" #define _PATH_DHCPD_PID "/var/run/dhcpd.pid"
#endif #endif
#ifndef _PATH_DHCPD6_PID
#define _PATH_DHCPD6_PID "/var/run/dhcpd6.pid"
#endif
#ifndef _PATH_DHCPD_DB #ifndef _PATH_DHCPD_DB
#define _PATH_DHCPD_DB "/var/db/dhcpd.leases" #define _PATH_DHCPD_DB "/var/db/dhcpd.leases"
#endif #endif
#ifndef _PATH_DHCPD6_DB
#define _PATH_DHCPD6_DB "/var/db/dhcpd6.leases"
#endif
#ifndef _PATH_DHCLIENT_PID #ifndef _PATH_DHCLIENT_PID
#define _PATH_DHCLIENT_PID "/var/run/dhclient.pid" #define _PATH_DHCLIENT_PID "/var/run/dhclient.pid"
#endif #endif

View File

@@ -75,6 +75,10 @@ extern int h_errno;
# define _PATH_DHCPD_PID "/etc/dhcpd.pid" # define _PATH_DHCPD_PID "/etc/dhcpd.pid"
#endif #endif
#if !defined (_PATH_DHCPD6_PID)
# define _PATH_DHCPD6_PID "/etc/dhcpd6.pid"
#endif
#if !defined (_PATH_DHCLIENT_PID) #if !defined (_PATH_DHCLIENT_PID)
# define _PATH_DHCLIENT_PID "/etc/dhclient.pid" # define _PATH_DHCLIENT_PID "/etc/dhclient.pid"
#endif #endif

View File

@@ -63,9 +63,15 @@ extern int h_errno;
#ifndef _PATH_DHCPD_PID #ifndef _PATH_DHCPD_PID
#define _PATH_DHCPD_PID "/var/run/dhcpd.pid" #define _PATH_DHCPD_PID "/var/run/dhcpd.pid"
#endif #endif
#ifndef _PATH_DHCPD6_PID
#define _PATH_DHCPD6_PID "/var/run/dhcpd6.pid"
#endif
#ifndef _PATH_DHCPD_DB #ifndef _PATH_DHCPD_DB
#define _PATH_DHCPD_DB "/var/db/dhcpd.leases" #define _PATH_DHCPD_DB "/var/db/dhcpd.leases"
#endif #endif
#ifndef _PATH_DHCPD6_DB
#define _PATH_DHCPD6_DB "/var/db/dhcpd6.leases"
#endif
#ifndef _PATH_DHCLIENT_PID #ifndef _PATH_DHCLIENT_PID
#define _PATH_DHCLIENT_PID "/var/run/dhclient.pid" #define _PATH_DHCLIENT_PID "/var/run/dhclient.pid"
#endif #endif

View File

@@ -66,6 +66,9 @@ extern int h_errno;
#ifndef _PATH_DHCPD_PID #ifndef _PATH_DHCPD_PID
#define _PATH_DHCPD_PID "/etc/dhcpd.pid" #define _PATH_DHCPD_PID "/etc/dhcpd.pid"
#endif #endif
#ifndef _PATH_DHCPD6_PID
#define _PATH_DHCPD6_PID "/etc/dhcpd6.pid"
#endif
#ifndef _PATH_DHCLIENT_PID #ifndef _PATH_DHCLIENT_PID
#define _PATH_DHCLIENT_PID "/etc/dhclient.pid" #define _PATH_DHCLIENT_PID "/etc/dhclient.pid"
#endif #endif

View File

@@ -63,9 +63,15 @@ extern int h_errno;
#ifndef _PATH_DHCPD_PID #ifndef _PATH_DHCPD_PID
#define _PATH_DHCPD_PID "/var/run/dhcpd.pid" #define _PATH_DHCPD_PID "/var/run/dhcpd.pid"
#endif #endif
#ifndef _PATH_DHCPD6_PID
#define _PATH_DHCPD6_PID "/var/run/dhcpd6.pid"
#endif
#ifndef _PATH_DHCPD_DB #ifndef _PATH_DHCPD_DB
#define _PATH_DHCPD_DB "/var/db/dhcpd.leases" #define _PATH_DHCPD_DB "/var/db/dhcpd.leases"
#endif #endif
#ifndef _PATH_DHCPD6_DB
#define _PATH_DHCPD6_DB "/var/db/dhcpd6.leases"
#endif
#ifndef _PATH_DHCLIENT_PID #ifndef _PATH_DHCLIENT_PID
#define _PATH_DHCLIENT_PID "/var/run/dhclient.pid" #define _PATH_DHCLIENT_PID "/var/run/dhclient.pid"
#endif #endif

View File

@@ -127,9 +127,15 @@ extern int h_errno;
#ifndef _PATH_DHCPD_PID #ifndef _PATH_DHCPD_PID
#define _PATH_DHCPD_PID "/etc/dhcpd.pid" #define _PATH_DHCPD_PID "/etc/dhcpd.pid"
#endif #endif
#ifndef _PATH_DHCPD6_PID
#define _PATH_DHCPD6_PID "/etc/dhcpd6.pid"
#endif
#ifndef _PATH_DHCLIENT_PID #ifndef _PATH_DHCLIENT_PID
#define _PATH_DHCLIENT_PID "/etc/dhclient.pid" #define _PATH_DHCLIENT_PID "/etc/dhclient.pid"
#endif #endif
#ifndef _PATH_DHCLIENT6_PID
#define _PATH_DHCLIENT6_PID "/etc/dhclient6.pid"
#endif
#ifndef _PATH_DHCRELAY_PID #ifndef _PATH_DHCRELAY_PID
#define _PATH_DHCRELAY_PID "/etc/dhcrelay.pid" #define _PATH_DHCRELAY_PID "/etc/dhcrelay.pid"
#endif #endif

View File

@@ -80,6 +80,9 @@ extern int h_errno;
#ifndef _PATH_DHCPD_PID #ifndef _PATH_DHCPD_PID
#define _PATH_DHCPD_PID "/etc/dhcpd.pid" #define _PATH_DHCPD_PID "/etc/dhcpd.pid"
#endif #endif
#ifndef _PATH_DHCPD6_PID
#define _PATH_DHCPD6_PID "/etc/dhcpd6.pid"
#endif
#ifndef _PATH_DHCLIENT_PID #ifndef _PATH_DHCLIENT_PID
#define _PATH_DHCLIENT_PID "/etc/dhclient.pid" #define _PATH_DHCLIENT_PID "/etc/dhclient.pid"
#endif #endif
@@ -92,6 +95,9 @@ extern int h_errno;
#ifndef _PATH_DHCPD_DB #ifndef _PATH_DHCPD_DB
#define _PATH_DHCPD_DB "/etc/dhcpd.leases" #define _PATH_DHCPD_DB "/etc/dhcpd.leases"
#endif #endif
#ifndef _PATH_DHCPD6_DB
#define _PATH_DHCPD6_DB "/etc/dhcpd6.leases"
#endif
#ifndef _PATH_DHCLIENT_DB #ifndef _PATH_DHCLIENT_DB
#define _PATH_DHCLIENT_DB "/etc/dhclient.leases" #define _PATH_DHCLIENT_DB "/etc/dhclient.leases"
#endif #endif

View File

@@ -99,6 +99,9 @@ extern int h_errno;
#ifndef _PATH_DHCPD_PID #ifndef _PATH_DHCPD_PID
#define _PATH_DHCPD_PID "/etc/dhcpd.pid" #define _PATH_DHCPD_PID "/etc/dhcpd.pid"
#endif #endif
#ifndef _PATH_DHCPD6_PID
#define _PATH_DHCPD6_PID "/etc/dhcpd6.pid"
#endif
#ifndef _PATH_DHCLIENT_PID #ifndef _PATH_DHCLIENT_PID
#define _PATH_DHCLIENT_PID "/etc/dhclient.pid" #define _PATH_DHCLIENT_PID "/etc/dhclient.pid"
#endif #endif

View File

@@ -93,6 +93,9 @@ extern int h_errno;
#ifndef _PATH_DHCPD_PID #ifndef _PATH_DHCPD_PID
#define _PATH_DHCPD_PID "/etc/dhcpd.pid" #define _PATH_DHCPD_PID "/etc/dhcpd.pid"
#endif #endif
#ifndef _PATH_DHCPD6_PID
#define _PATH_DHCPD6_PID "/etc/dhcpd6.pid"
#endif
#ifndef _PATH_DHCLIENT_PID #ifndef _PATH_DHCLIENT_PID
#define _PATH_DHCLIENT_PID "/etc/dhclient.pid" #define _PATH_DHCLIENT_PID "/etc/dhclient.pid"
#endif #endif

View File

@@ -52,6 +52,9 @@ extern int h_errno;
#ifndef _PATH_DHCPD_PID #ifndef _PATH_DHCPD_PID
#define _PATH_DHCPD_PID "/etc/dhcpd.pid" #define _PATH_DHCPD_PID "/etc/dhcpd.pid"
#endif #endif
#ifndef _PATH_DHCPD6_PID
#define _PATH_DHCPD6_PID "/etc/dhcpd6.pid"
#endif
#ifndef _PATH_DHCLIENT_PID #ifndef _PATH_DHCLIENT_PID
#define _PATH_DHCLIENT_PID "/etc/dhclient.pid" #define _PATH_DHCLIENT_PID "/etc/dhclient.pid"
#endif #endif

View File

@@ -618,6 +618,8 @@ struct lease_state {
#define SV_DO_REVERSE_UPDATES 51 #define SV_DO_REVERSE_UPDATES 51
#define SV_FQDN_REPLY 52 #define SV_FQDN_REPLY 52
#define SV_PREFER_LIFETIME 53 #define SV_PREFER_LIFETIME 53
#define SV_DHCPV6_LEASE_FILE_NAME 54
#define SV_DHCPV6_PID_FILE_NAME 55
#if !defined (DEFAULT_PING_TIMEOUT) #if !defined (DEFAULT_PING_TIMEOUT)
# define DEFAULT_PING_TIMEOUT 1 # define DEFAULT_PING_TIMEOUT 1
@@ -1224,9 +1226,14 @@ typedef unsigned char option_mask [16];
#define _PATH_DHCPD_CONF "dhcpd.conf" #define _PATH_DHCPD_CONF "dhcpd.conf"
#undef _PATH_DHCPD_DB #undef _PATH_DHCPD_DB
#define _PATH_DHCPD_DB "dhcpd.leases" #define _PATH_DHCPD_DB "dhcpd.leases"
#undef _PATH_DHCPD6_DB
#define _PATH_DHCPD6_DB "dhcpd6.leases"
#undef _PATH_DHCPD_PID #undef _PATH_DHCPD_PID
#define _PATH_DHCPD_PID "dhcpd.pid" #define _PATH_DHCPD_PID "dhcpd.pid"
#undef _PATH_DHCPD6_PID
#define _PATH_DHCPD6_PID "dhcpd6.pid"
#else /* !DEBUG */ #else /* !DEBUG */
#ifndef _PATH_DHCPD_CONF #ifndef _PATH_DHCPD_CONF
#define _PATH_DHCPD_CONF "/etc/dhcpd.conf" #define _PATH_DHCPD_CONF "/etc/dhcpd.conf"
#endif /* DEBUG */ #endif /* DEBUG */
@@ -1235,11 +1242,20 @@ typedef unsigned char option_mask [16];
#define _PATH_DHCPD_DB LOCALSTATEDIR"/db/dhcpd.leases" #define _PATH_DHCPD_DB LOCALSTATEDIR"/db/dhcpd.leases"
#endif #endif
#ifndef _PATH_DHCPD6_DB
#define _PATH_DHCPD6_DB LOCALSTATEDIR"/db/dhcpd6.leases"
#endif
#ifndef _PATH_DHCPD_PID #ifndef _PATH_DHCPD_PID
#define _PATH_DHCPD_PID LOCALSTATEDIR"/run/dhcpd.pid" #define _PATH_DHCPD_PID LOCALSTATEDIR"/run/dhcpd.pid"
#endif #endif
#ifndef _PATH_DHCPD6_PID
#define _PATH_DHCPD6_PID LOCALSTATEDIR"/run/dhcpd6.pid"
#endif #endif
#endif /* DEBUG */
#ifndef _PATH_DHCLIENT_CONF #ifndef _PATH_DHCLIENT_CONF
#define _PATH_DHCLIENT_CONF "/etc/dhclient.conf" #define _PATH_DHCLIENT_CONF "/etc/dhclient.conf"
#endif #endif

View File

@@ -314,6 +314,7 @@ main(int argc, char **argv) {
} else if (!strcmp (argv [i], "-q")) { } else if (!strcmp (argv [i], "-q")) {
quiet = 1; quiet = 1;
quiet_interface_discovery = 1; quiet_interface_discovery = 1;
#ifdef DHCPv6
} else if (!strcmp(argv[i], "-4")) { } else if (!strcmp(argv[i], "-4")) {
if (local_family_set && (local_family != AF_INET)) { if (local_family_set && (local_family != AF_INET)) {
log_fatal("Server cannot run in both IPv4 and " log_fatal("Server cannot run in both IPv4 and "
@@ -328,6 +329,7 @@ main(int argc, char **argv) {
} }
local_family = AF_INET6; local_family = AF_INET6;
local_family_set = 1; local_family_set = 1;
#endif /* DHCPv6 */
} else if (!strcmp (argv [i], "--version")) { } else if (!strcmp (argv [i], "--version")) {
log_info("isc-dhcpd-%s", PACKAGE_VERSION); log_info("isc-dhcpd-%s", PACKAGE_VERSION);
exit (0); exit (0);
@@ -366,12 +368,33 @@ main(int argc, char **argv) {
if (!no_dhcpd_conf && (s = getenv ("PATH_DHCPD_CONF"))) { if (!no_dhcpd_conf && (s = getenv ("PATH_DHCPD_CONF"))) {
path_dhcpd_conf = s; path_dhcpd_conf = s;
} }
if (!no_dhcpd_db && (s = getenv ("PATH_DHCPD_DB"))) {
path_dhcpd_db = s; #ifdef DHCPv6
} if (local_family == AF_INET6) {
if (!no_dhcpd_pid && (s = getenv ("PATH_DHCPD_PID"))) { /* DHCPv6: override DHCPv4 lease and pid filenames */
path_dhcpd_pid = s; if (!no_dhcpd_db) {
} if ((s = getenv ("PATH_DHCPD6_DB")))
path_dhcpd_db = s;
else
path_dhcpd_db = _PATH_DHCPD6_DB;
}
if (!no_dhcpd_pid) {
if ((s = getenv ("PATH_DHCPD6_PID")))
path_dhcpd_pid = s;
else
path_dhcpd_pid = _PATH_DHCPD6_PID;
}
} else
#else /* !DHCPv6 */
{
if (!no_dhcpd_db && (s = getenv ("PATH_DHCPD_DB"))) {
path_dhcpd_db = s;
}
if (!no_dhcpd_pid && (s = getenv ("PATH_DHCPD_PID"))) {
path_dhcpd_pid = s;
}
}
#endif /* DHCPv6 */
/* /*
* convert relative path names to absolute, for files that need * convert relative path names to absolute, for files that need
@@ -738,7 +761,7 @@ void postconf_initialization (int quiet)
data_string_forget (&db, MDL); data_string_forget (&db, MDL);
path_dhcpd_db = s; path_dhcpd_db = s;
} }
oc = lookup_option (&server_universe, options, SV_PID_FILE_NAME); oc = lookup_option (&server_universe, options, SV_PID_FILE_NAME);
if (oc && if (oc &&
evaluate_option_cache (&db, (struct packet *)0, evaluate_option_cache (&db, (struct packet *)0,
@@ -754,6 +777,44 @@ void postconf_initialization (int quiet)
path_dhcpd_pid = s; path_dhcpd_pid = s;
} }
#ifdef DHCPv6
if (local_family == AF_INET6) {
/*
* Override lease file name with dhcpv6 lease file name,
* if it was set; then, do the same with the pid file name
*/
oc = lookup_option(&server_universe, options,
SV_DHCPV6_LEASE_FILE_NAME);
if (oc &&
evaluate_option_cache(&db, NULL, NULL, NULL,
options, NULL, &global_scope,
oc, MDL)) {
s = dmalloc (db.len + 1, MDL);
if (!s)
log_fatal ("no memory for lease db filename.");
memcpy (s, db.data, db.len);
s [db.len] = 0;
data_string_forget (&db, MDL);
path_dhcpd_db = s;
}
oc = lookup_option(&server_universe, options,
SV_DHCPV6_PID_FILE_NAME);
if (oc &&
evaluate_option_cache(&db, NULL, NULL, NULL,
options, NULL, &global_scope,
oc, MDL)) {
s = dmalloc (db.len + 1, MDL);
if (!s)
log_fatal ("no memory for lease db filename.");
memcpy (s, db.data, db.len);
s [db.len] = 0;
data_string_forget (&db, MDL);
path_dhcpd_pid = s;
}
}
#endif /* DHCPv6 */
omapi_port = -1; omapi_port = -1;
oc = lookup_option (&server_universe, options, SV_OMAPI_PORT); oc = lookup_option (&server_universe, options, SV_OMAPI_PORT);
if (oc && if (oc &&
@@ -963,7 +1024,11 @@ usage(void) {
log_info(arr); log_info(arr);
log_fatal("Usage: dhcpd [-p <UDP port #>] [-f] [-d] [-q] [-t|-T]\n" log_fatal("Usage: dhcpd [-p <UDP port #>] [-f] [-d] [-q] [-t|-T]\n"
#ifdef DHCPv6
" [-4|-6] [-cf config-file] [-lf lease-file]\n" " [-4|-6] [-cf config-file] [-lf lease-file]\n"
#else /* !DHCPv6 */
" [-cf config-file] [-lf lease-file]\n"
#endif /* DHCPv6 */
#if defined (TRACING) #if defined (TRACING)
" [-tf trace-output-file]\n" " [-tf trace-output-file]\n"
" [-play trace-input-file]\n" " [-play trace-input-file]\n"

View File

@@ -28,7 +28,7 @@
.\" see ``http://www.vix.com''. To learn more about Nominum, Inc., see .\" see ``http://www.vix.com''. To learn more about Nominum, Inc., see
.\" ``http://www.nominum.com''. .\" ``http://www.nominum.com''.
.\" .\"
.\" $Id: dhcpd.conf.5,v 1.88 2007/09/17 10:13:07 shane Exp $ .\" $Id: dhcpd.conf.5,v 1.89 2007/10/27 19:15:36 each Exp $
.\" .\"
.TH dhcpd.conf 5 .TH dhcpd.conf 5
.SH NAME .SH NAME
@@ -2230,7 +2230,36 @@ statement
should be the name of the DHCP server's lease file. By default, this 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 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 have no effect. 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.
.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 .RE
.PP .PP
The The
@@ -2422,8 +2451,36 @@ statement
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
lease-file-name statement, this statement must appear in the outer scope .I lease-file-name
of the configuration file. 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.
.PP
The
.I dhcpv6-pid-file-name
statement
.RS 0.25i
.PP
.B dhcpv6-pid-file-name \fIname\fB;\fR
.PP
.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.
.RE .RE
.PP .PP
The The

View File

@@ -235,6 +235,8 @@ static struct option server_options[] = {
{ "do-reverse-updates", "f", &server_universe, 51, 1 }, { "do-reverse-updates", "f", &server_universe, 51, 1 },
{ "fqdn-reply", "f", &server_universe, 52, 1 }, { "fqdn-reply", "f", &server_universe, 52, 1 },
{ "preferred-lifetime", "T", &server_universe, 53, 1 }, { "preferred-lifetime", "T", &server_universe, 53, 1 },
{ "dhcpv6-lease-file-name", "t", &server_universe, 54, 1 },
{ "dhcpv6-pid-file-name", "t", &server_universe, 55, 1 },
{ NULL, NULL, NULL, 0, 0 } { NULL, NULL, NULL, 0, 0 }
}; };