2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-28 12:57:42 +00:00

[master] Adds persist-eui-64-leases config parameter and support

Merges in rt45046.
This commit is contained in:
Thomas Markwalder 2017-12-11 07:45:10 -05:00
parent 7b4f284e50
commit c2e5ee2882
6 changed files with 87 additions and 19 deletions

View File

@ -298,6 +298,11 @@ dhcp-users@lists.isc.org.
default), hmac-sha1, hmac-sha224, hmac-sha256, hmac-sha384, and hmac-sha512.
[ISC-Bugs #46771]
- Added a server configuration parameter, persist-eui-64-leases, which
determines whether or not EUI-64 based leases are written to the
leases file. Default is true.
[ISC-Bugs #45046]
Changes since 4.3.0 (bug fixes)
- Tidy up several small tickets.

View File

@ -801,6 +801,7 @@ struct lease_state {
#define SV_ABANDON_LEASE_TIME 89
#ifdef EUI_64
#define SV_USE_EUI_64 90
#define SV_PERSIST_EUI_64_LEASES 91
#endif
#if defined (FAILOVER_PROTOCOL)
#define SV_CHECK_SECS_BYTE_ORDER 91
@ -2099,6 +2100,10 @@ extern u_int16_t ddns_conflict_mask;
extern int dont_use_fsync;
extern int server_id_check;
#ifdef EUI_64
extern int persist_eui64;
#endif
extern int prefix_length_mode;
extern int authoring_byte_order;
extern int lease_id_format;

View File

@ -525,6 +525,27 @@ write_ia(const struct ia_xx *ia) {
char *s;
int fprintf_ret;
#ifdef EUI_64
/* If we're not writing EUI64 leases to the file, then
* we can skip writing this IA provided all of its leases
* are EUI64. (Not sure you can ever have a case where
* they aren't but doesn't hurt to check) */
if (ia->ia_type == D6O_IA_NA && !persist_eui64) {
int i;
for (i=0; i < ia->num_iasubopt; i++) {
if (!ia->iasubopt[i]->ipv6_pool->ipv6_pond->use_eui_64)
{
break;
}
}
if (i == ia->num_iasubopt) {
/* Their all EUI64 so we can skip it */
return(1);
}
}
#endif
/*
* If the lease file is corrupt, don't try to write any more
* leases until we've written a good lease file.

View File

@ -82,6 +82,10 @@ int dont_use_fsync = 0; /* 0 = default, use fsync, 1 = don't use fsync */
int server_id_check = 0; /* 0 = default, don't check server id, 1 = do check */
int prefix_length_mode = PLM_PREFER;
#ifdef EUI_64
int persist_eui64 = 1; /* 1 = write EUI64 leases to disk, 0 = don't */
#endif
int authoring_byte_order = 0; /* 0 = not set */
int lease_id_format = TOKEN_OCTAL; /* octal by default */
u_int32_t abandon_lease_time = DEFAULT_ABANDON_LEASE_TIME;
@ -847,8 +851,9 @@ main(int argc, char **argv) {
#endif
/* test option should cause an early exit */
if (cftest && !lftest)
if (cftest && !lftest) {
exit(0);
}
/*
* First part of dealing with pid files. Check to see if
@ -1396,6 +1401,21 @@ void postconf_initialization (int quiet)
}
#endif
#ifdef EUI_64
oc = lookup_option(&server_universe, options, SV_PERSIST_EUI_64_LEASES);
if (oc != NULL) {
persist_eui64 = evaluate_boolean_option_cache(NULL, NULL, NULL,
NULL, options,
NULL,
&global_scope,
oc, MDL);
}
if (!persist_eui64) {
log_info("EUI64 leases will not be written to lease file");
}
#endif
#if defined (BINARY_LEASES)
if (local_family == AF_INET) {
log_info("Source compiled to use binary-leases");

View File

@ -2920,6 +2920,21 @@ or provable, so we urge caution in the use of this statement.
.RE
.PP
The
.I persist-eui-64-leases
statement
.RS 0.25i
.PP
.B persist-eui-64-leases \fIflag\fR\fB;\fR
.PP
When this flag is enabled, the server will write EUI-64 based leases to the
leases file. Since such leases can only, ever be valid for a single DUID value
it can be argued that writing them to the leases file isn't essential and not
doing so may have perfomance advantages. See \fIuse-eui-64\fR statement for
more details on EUI-64 based address allocation. The flag is enabled by
default and may only be set at the global scope.
.RE
.PP
The
.I pid-file-name
statement
.RS 0.25i
@ -3349,8 +3364,6 @@ in use. Also, the server must attempt the update each time the
client renews its lease, which could have a significant performance
impact in environments that place heavy demands on the DHCP server.
.RE
.PP
The
.I use-eui-64
@ -3413,6 +3426,9 @@ message:
Request - Server will send "an address not on link status", and no ia
suboption Renew/Rebind - Server will send the requested address ia
suboption with lifetimes of 0, plus an EUI-64 ia
Whether or not EUI-64 based leases are written out to the lease database
may be controlled by \fIpersist-eui-64-leases\fR statement.
.RE
.PP
The

View File

@ -279,6 +279,7 @@ static struct option server_options[] = {
{ "abandon-lease-time", "T", &server_universe, SV_ABANDON_LEASE_TIME, 1 },
#ifdef EUI_64
{ "use-eui-64", "f", &server_universe, SV_USE_EUI_64, 1 },
{ "persist-eui-64-leases", "f", &server_universe, SV_PERSIST_EUI_64_LEASES, 1 },
#endif
#if defined (FAILOVER_PROTOCOL)
{ "check-secs-byte-order", "f", &server_universe, SV_CHECK_SECS_BYTE_ORDER, 1 },