diff options
author | David Hankins <dhankins@isc.org> | 2006-05-17 20:16:59 +0000 |
---|---|---|
committer | David Hankins <dhankins@isc.org> | 2006-05-17 20:16:59 +0000 |
commit | e3a153b26f98eb3ce85ec2ecb45426cfcecc7609 (patch) | |
tree | d54e4e5b33ee9189d033c70e97ffaf6676724d12 | |
parent | 007852ed4eb8ccf448266640df2bdf74e491bd10 (diff) | |
download | isc-dhcp-e3a153b26f98eb3ce85ec2ecb45426cfcecc7609.tar.gz |
- 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]
-rw-r--r-- | RELNOTES | 5 | ||||
-rw-r--r-- | includes/dhcpd.h | 2 | ||||
-rw-r--r-- | server/dhcp.c | 30 |
3 files changed, 16 insertions, 21 deletions
@@ -80,6 +80,7 @@ Murrell at BC Tel Advanced Communications. I'd like to express my thanks to all of these good people here, both for working on the code and for prodding me into improving it. + Changes since 3.0.4 - A warning that host statements declared within subnet or shared-network @@ -93,6 +94,10 @@ and for prodding me into improving it. state count calculations (free/active counts used for failover pool 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 - The dhcp-options.5 manpage was updated to correct indentation errors diff --git a/includes/dhcpd.h b/includes/dhcpd.h index 3059e466..af1e0b95 100644 --- a/includes/dhcpd.h +++ b/includes/dhcpd.h @@ -339,7 +339,7 @@ struct lease_state { struct option_state *options; struct data_string parameter_request_list; int max_message_size; - TIME expiry, renewal, rebind; + unsigned char expiry[4], renewal[4], rebind[4]; struct data_string filename, server_name; int got_requested_address; int got_server_identifier; diff --git a/server/dhcp.c b/server/dhcp.c index de61dbea..a0cae37b 100644 --- a/server/dhcp.c +++ b/server/dhcp.c @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: dhcp.c,v 1.192.2.61 2006/02/22 22:43:27 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n"; +"$Id: dhcp.c,v 1.192.2.62 2006/05/17 20:16:59 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -2442,18 +2442,15 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp) offered_lease_time = state -> offered_expiry - cur_time; - putULong ((unsigned char *)&state -> expiry, - (unsigned long)offered_lease_time); + putULong(state->expiry, (u_int32_t)offered_lease_time); i = DHO_DHCP_LEASE_TIME; if (lookup_option (&dhcp_universe, state -> options, i)) log_error ("dhcp-lease-time option for %s overridden.", inet_ntoa (state -> ciaddr)); oc = (struct option_cache *)0; if (option_cache_allocate (&oc, MDL)) { - if (make_const_data (&oc -> expression, - (unsigned char *)&state -> expiry, - sizeof state -> expiry, - 0, 0, MDL)) { + if (make_const_data(&oc->expression, state->expiry, + 4, 0, 0, MDL)) { oc -> option = dhcp_universe.options [i]; save_option (&dhcp_universe, state -> options, oc); @@ -2463,19 +2460,15 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp) /* Renewal time is lease time * 0.5. */ offered_lease_time /= 2; - putULong ((unsigned char *)&state -> renewal, - (unsigned long)offered_lease_time); + putULong(state->renewal, (u_int32_t)offered_lease_time); i = DHO_DHCP_RENEWAL_TIME; if (lookup_option (&dhcp_universe, state -> options, i)) log_error ("overriding dhcp-renewal-time for %s.", inet_ntoa (state -> ciaddr)); oc = (struct option_cache *)0; if (option_cache_allocate (&oc, MDL)) { - if (make_const_data (&oc -> expression, - (unsigned char *) - &state -> renewal, - sizeof state -> renewal, - 0, 0, MDL)) { + if (make_const_data(&oc->expression, state->renewal, + 4, 0, 0, MDL)) { oc -> option = dhcp_universe.options [i]; save_option (&dhcp_universe, state -> options, oc); @@ -2486,18 +2479,15 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp) /* Rebinding time is lease time * 0.875. */ offered_lease_time += (offered_lease_time / 2 + offered_lease_time / 4); - putULong ((unsigned char *)&state -> rebind, - (unsigned)offered_lease_time); + putULong(state->rebind, (u_int32_t)offered_lease_time); i = DHO_DHCP_REBINDING_TIME; if (lookup_option (&dhcp_universe, state -> options, i)) log_error ("overriding dhcp-rebinding-time for %s.", inet_ntoa (state -> ciaddr)); oc = (struct option_cache *)0; if (option_cache_allocate (&oc, MDL)) { - if (make_const_data (&oc -> expression, - (unsigned char *)&state -> rebind, - sizeof state -> rebind, - 0, 0, MDL)) { + if (make_const_data(&oc->expression, state->rebind, + 4, 0, 0, MDL)) { oc -> option = dhcp_universe.options [i]; save_option (&dhcp_universe, state -> options, oc); |