2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-09-03 15:56:00 +00:00

- Some time value size fixes in 3.0.4 brought on from FreeBSD /usr/ports were

misapplied to server values rather than client values.  The server no longer
  advertises 8-byte lease-time options when on 64-bit platforms.
  [ISC-Bugs #16036]
This commit is contained in:
David Hankins
2006-05-17 20:15:32 +00:00
parent 7d7073e7da
commit dcc557db27
3 changed files with 15 additions and 21 deletions

View File

@@ -98,6 +98,10 @@ and for prodding me into improving it.
state count calculations (free/active counts used for failover pool state count calculations (free/active counts used for failover pool
balancing). balancing).
- Some time value size fixes in 3.0.4 brought on from FreeBSD /usr/ports were
misapplied to server values rather than client values. The server no longer
advertises 8-byte lease-time options when on 64-bit platforms.
Changes since 3.0.4rc1 Changes since 3.0.4rc1
- The dhcp-options.5 manpage was updated to correct indentation errors - The dhcp-options.5 manpage was updated to correct indentation errors

View File

@@ -346,7 +346,7 @@ struct lease_state {
struct option_state *options; struct option_state *options;
struct data_string parameter_request_list; struct data_string parameter_request_list;
int max_message_size; int max_message_size;
TIME expiry, renewal, rebind; unsigned char expiry[4], renewal[4], rebind[4];
struct data_string filename, server_name; struct data_string filename, server_name;
int got_requested_address; int got_requested_address;
int got_server_identifier; int got_server_identifier;

View File

@@ -34,7 +34,7 @@
#ifndef lint #ifndef lint
static char copyright[] = static char copyright[] =
"$Id: dhcp.c,v 1.202 2006/04/27 17:26:42 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n"; "$Id: dhcp.c,v 1.203 2006/05/17 20:15:32 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -2491,18 +2491,15 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp)
offered_lease_time = offered_lease_time =
state -> offered_expiry - cur_time; state -> offered_expiry - cur_time;
putULong ((unsigned char *)&state -> expiry, putULong(state->expiry, (u_int32_t)offered_lease_time);
(unsigned long)offered_lease_time);
i = DHO_DHCP_LEASE_TIME; i = DHO_DHCP_LEASE_TIME;
if (lookup_option (&dhcp_universe, state -> options, i)) if (lookup_option (&dhcp_universe, state -> options, i))
log_error ("dhcp-lease-time option for %s overridden.", log_error ("dhcp-lease-time option for %s overridden.",
inet_ntoa (state -> ciaddr)); inet_ntoa (state -> ciaddr));
oc = (struct option_cache *)0; oc = (struct option_cache *)0;
if (option_cache_allocate (&oc, MDL)) { if (option_cache_allocate (&oc, MDL)) {
if (make_const_data (&oc -> expression, if (make_const_data(&oc->expression, state->expiry,
(unsigned char *)&state -> expiry, 4, 0, 0, MDL)) {
sizeof state -> expiry,
0, 0, MDL)) {
oc -> option = dhcp_universe.options [i]; oc -> option = dhcp_universe.options [i];
save_option (&dhcp_universe, save_option (&dhcp_universe,
state -> options, oc); state -> options, oc);
@@ -2512,19 +2509,15 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp)
/* Renewal time is lease time * 0.5. */ /* Renewal time is lease time * 0.5. */
offered_lease_time /= 2; offered_lease_time /= 2;
putULong ((unsigned char *)&state -> renewal, putULong(state->renewal, (u_int32_t)offered_lease_time);
(unsigned long)offered_lease_time);
i = DHO_DHCP_RENEWAL_TIME; i = DHO_DHCP_RENEWAL_TIME;
if (lookup_option (&dhcp_universe, state -> options, i)) if (lookup_option (&dhcp_universe, state -> options, i))
log_error ("overriding dhcp-renewal-time for %s.", log_error ("overriding dhcp-renewal-time for %s.",
inet_ntoa (state -> ciaddr)); inet_ntoa (state -> ciaddr));
oc = (struct option_cache *)0; oc = (struct option_cache *)0;
if (option_cache_allocate (&oc, MDL)) { if (option_cache_allocate (&oc, MDL)) {
if (make_const_data (&oc -> expression, if (make_const_data(&oc->expression, state->renewal,
(unsigned char *) 4, 0, 0, MDL)) {
&state -> renewal,
sizeof state -> renewal,
0, 0, MDL)) {
oc -> option = dhcp_universe.options [i]; oc -> option = dhcp_universe.options [i];
save_option (&dhcp_universe, save_option (&dhcp_universe,
state -> options, oc); state -> options, oc);
@@ -2535,18 +2528,15 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp)
/* Rebinding time is lease time * 0.875. */ /* Rebinding time is lease time * 0.875. */
offered_lease_time += (offered_lease_time / 2 offered_lease_time += (offered_lease_time / 2
+ offered_lease_time / 4); + offered_lease_time / 4);
putULong ((unsigned char *)&state -> rebind, putULong(state->rebind, (u_int32_t)offered_lease_time);
(unsigned)offered_lease_time);
i = DHO_DHCP_REBINDING_TIME; i = DHO_DHCP_REBINDING_TIME;
if (lookup_option (&dhcp_universe, state -> options, i)) if (lookup_option (&dhcp_universe, state -> options, i))
log_error ("overriding dhcp-rebinding-time for %s.", log_error ("overriding dhcp-rebinding-time for %s.",
inet_ntoa (state -> ciaddr)); inet_ntoa (state -> ciaddr));
oc = (struct option_cache *)0; oc = (struct option_cache *)0;
if (option_cache_allocate (&oc, MDL)) { if (option_cache_allocate (&oc, MDL)) {
if (make_const_data (&oc -> expression, if (make_const_data(&oc->expression, state->rebind,
(unsigned char *)&state -> rebind, 4, 0, 0, MDL)) {
sizeof state -> rebind,
0, 0, MDL)) {
oc -> option = dhcp_universe.options [i]; oc -> option = dhcp_universe.options [i];
save_option (&dhcp_universe, save_option (&dhcp_universe,
state -> options, oc); state -> options, oc);