diff options
author | des <des@FreeBSD.org> | 2004-07-06 15:15:14 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2004-07-06 15:15:14 +0000 |
commit | 7c905c6c6ca553210ff7dcc2a016e4aaf7d3750c (patch) | |
tree | 5afe645c04263acc3cc4605480900b5778e8ad15 /contrib/isc-dhcp | |
parent | 2820cb04742e5041387dcda61f326a7da26b569e (diff) | |
download | FreeBSD-src-7c905c6c6ca553210ff7dcc2a016e4aaf7d3750c.zip FreeBSD-src-7c905c6c6ca553210ff7dcc2a016e4aaf7d3750c.tar.gz |
Fix a number of incorrect assumptions regarding the size of time_t.
The code has its own TIME type, which is actually defined to time_t,
but it still used u_int32_t in some places.
In addition, dhclient not only had two separate global cur_time
variables, one of which was defined as u_int32_t and the other as
TIME, but cur_time was sometimes shadowed by local variables, leading
to widespread confusion as to which of these variable was being
referenced.
There is a lesson in here somewhere: a decent compiler with warnings
enabled should have caught all of this long before it became a
problem.
This patch has been submitted to the vendor, but it will likely be
some time before they release a version that includes it.
Approved by: mbr
Diffstat (limited to 'contrib/isc-dhcp')
-rw-r--r-- | contrib/isc-dhcp/client/dhclient.c | 2 | ||||
-rw-r--r-- | contrib/isc-dhcp/common/dispatch.c | 3 | ||||
-rw-r--r-- | contrib/isc-dhcp/includes/dhcpd.h | 4 | ||||
-rw-r--r-- | contrib/isc-dhcp/omapip/dispatch.c | 4 | ||||
-rw-r--r-- | contrib/isc-dhcp/omapip/mrtrace.c | 4 |
5 files changed, 10 insertions, 7 deletions
diff --git a/contrib/isc-dhcp/client/dhclient.c b/contrib/isc-dhcp/client/dhclient.c index cc4061a..00e681f 100644 --- a/contrib/isc-dhcp/client/dhclient.c +++ b/contrib/isc-dhcp/client/dhclient.c @@ -46,7 +46,7 @@ static char ocopyright[] = #include <net80211/ieee80211.h> #endif -TIME cur_time; +extern TIME cur_time; TIME default_lease_time = 43200; /* 12 hours... */ TIME max_lease_time = 86400; /* 24 hours... */ diff --git a/contrib/isc-dhcp/common/dispatch.c b/contrib/isc-dhcp/common/dispatch.c index c9a7a2a..326ed1f 100644 --- a/contrib/isc-dhcp/common/dispatch.c +++ b/contrib/isc-dhcp/common/dispatch.c @@ -47,7 +47,7 @@ static struct timeout *free_timeouts; extern int polling_interval; #endif -void set_time (u_int32_t t) +void set_time (TIME t) { /* Do any outstanding timeouts. */ if (cur_time != t) { @@ -95,7 +95,6 @@ void dispatch () struct timeval *tvp_new; #endif isc_result_t status; - TIME cur_time; tvp = NULL; #ifdef ENABLE_POLLING_MODE diff --git a/contrib/isc-dhcp/includes/dhcpd.h b/contrib/isc-dhcp/includes/dhcpd.h index 90bbc51..37f9a8e 100644 --- a/contrib/isc-dhcp/includes/dhcpd.h +++ b/contrib/isc-dhcp/includes/dhcpd.h @@ -335,7 +335,7 @@ struct lease_state { struct option_state *options; struct data_string parameter_request_list; int max_message_size; - u_int32_t expiry, renewal, rebind; + TIME expiry, renewal, rebind; struct data_string filename, server_name; int got_requested_address; int got_server_identifier; @@ -1764,7 +1764,7 @@ int if_readsocket PROTO ((omapi_object_t *)); void reinitialize_interfaces PROTO ((void)); /* dispatch.c */ -void set_time (u_int32_t); +void set_time (TIME); struct timeval *process_outstanding_timeouts (struct timeval *); void dispatch PROTO ((void)); isc_result_t got_one PROTO ((omapi_object_t *)); diff --git a/contrib/isc-dhcp/omapip/dispatch.c b/contrib/isc-dhcp/omapip/dispatch.c index fab14be..e10a76a 100644 --- a/contrib/isc-dhcp/omapip/dispatch.c +++ b/contrib/isc-dhcp/omapip/dispatch.c @@ -30,12 +30,14 @@ * ``http://www.isc.org/''. To learn more about Vixie Enterprises, * see ``http://www.vix.com''. To learn more about Nominum, Inc., see * ``http://www.nominum.com''. + * + * $FreeBSD$ */ #include <omapip/omapip_p.h> static omapi_io_object_t omapi_io_states; -u_int32_t cur_time; +TIME cur_time; OMAPI_OBJECT_ALLOC (omapi_io, omapi_io_object_t, omapi_type_io_object) diff --git a/contrib/isc-dhcp/omapip/mrtrace.c b/contrib/isc-dhcp/omapip/mrtrace.c index dfc24ff..4e599d4 100644 --- a/contrib/isc-dhcp/omapip/mrtrace.c +++ b/contrib/isc-dhcp/omapip/mrtrace.c @@ -28,6 +28,8 @@ * by Ted Lemon, as part of a project for Nominum, Inc. To learn more * about Internet Systems Consortium, see http://www.isc.org/. To * learn more about Nominum, Inc., see ``http://www.nominum.com''. + * + * $FreeBSD$ */ #include <omapip/omapip_p.h> @@ -61,7 +63,7 @@ time_t trace_mr_time (time_t *); int trace_mr_select (int, fd_set *, fd_set *, fd_set *, struct timeval *); unsigned int trace_mr_res_randomid (unsigned int); -extern time_t cur_time; +extern TIME cur_time; #if defined (TRACING) void trace_mr_init () |