Date: Mon, 28 Jun 2004 18:55:18 +0200 From: des@des.no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=) To: Joerg Wunsch <joerg_wunsch@interface-systems.de> Cc: sparc64@freebsd.org Subject: Re: 64-bit time_t safe lease time Message-ID: <xzpfz8fy64p.fsf@dwp.des.no> In-Reply-To: <20040628160937.D21248@ida.interface-business.de> (Joerg Wunsch's message of "Mon, 28 Jun 2004 16:09:37 %2B0200") References: <20040627005719.M38063@cvs.imp.ch> <20040627090642.A75210@ida.interface-business.de> <20040627101539.G38063@cvs.imp.ch> <20040627115951.C75210@ida.interface-business.de> <20040627160033.G75210@ida.interface-business.de> <xzp1xk0ylmu.fsf@dwp.des.no> <20040628160937.D21248@ida.interface-business.de>
next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Joerg Wunsch <j@ida.interface-business.de> writes: > As Dag-Erling Sm=F8rgrav wrote: > > The attached patch addresses these inconsistencies, but I have not > > verified that it corrects the 64-bit time_t problem. > It seems to work, too. I backed out Martin Blapp's previous + my > GET_TIME() patch, and applied your one. I get a few compilation > warnings: I believe these warnings are unrelated to the patch. there are plenty of places that use int32_t or even worse u_int32_t to hold time. items from dhcpd.h that look suspicious to me include: lease_state.expiry lease_state.renewal lease_state.rebind client_config.requested_lease set_time() nsupdateA() nsupdatePTR() I've attached a patch that includes the previous one and also fixes some of the above. it builds with zero warnings on i386, and one (unrelated) on alpha. unfortunately, time_t is not the only source of trouble for isc-dhcp on 64-bit platforms. parts the code also seem to assume that pointers are 32-bit (this triggers the aforementioned warning on alpha). btw, none of this actually gets to the dhcp lists since they are subscriber-only and I don't particularly feel like subscribing, so all my emails bounce. DES --=20 Dag-Erling Sm=F8rgrav - des@des.no --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=isc-dhcp.diff Index: client/dhclient.c =================================================================== RCS file: /home/ncvs/src/contrib/isc-dhcp/client/dhclient.c,v retrieving revision 1.37 diff -u -r1.37 dhclient.c --- client/dhclient.c 26 Jun 2004 10:37:41 -0000 1.37 +++ client/dhclient.c 28 Jun 2004 11:16:11 -0000 @@ -46,7 +46,7 @@ #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... */ Index: common/dispatch.c =================================================================== RCS file: /home/ncvs/src/contrib/isc-dhcp/common/dispatch.c,v retrieving revision 1.5 diff -u -r1.5 dispatch.c --- common/dispatch.c 26 Jun 2004 10:37:41 -0000 1.5 +++ common/dispatch.c 28 Jun 2004 16:49:16 -0000 @@ -47,7 +47,7 @@ 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 @@ struct timeval *tvp_new; #endif isc_result_t status; - TIME cur_time; tvp = NULL; #ifdef ENABLE_POLLING_MODE Index: includes/dhcpd.h =================================================================== RCS file: /home/ncvs/src/contrib/isc-dhcp/includes/dhcpd.h,v retrieving revision 1.9 diff -u -r1.9 dhcpd.h --- includes/dhcpd.h 26 Jun 2004 10:37:42 -0000 1.9 +++ includes/dhcpd.h 28 Jun 2004 16:49:23 -0000 @@ -335,7 +335,7 @@ 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 @@ 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 *)); Index: omapip/dispatch.c =================================================================== RCS file: /home/ncvs/src/contrib/isc-dhcp/omapip/dispatch.c,v retrieving revision 1.1.1.2 diff -u -r1.1.1.2 dispatch.c --- omapip/dispatch.c 26 Jun 2004 10:34:24 -0000 1.1.1.2 +++ omapip/dispatch.c 28 Jun 2004 11:11:17 -0000 @@ -35,7 +35,7 @@ #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) Index: omapip/mrtrace.c =================================================================== RCS file: /home/ncvs/src/contrib/isc-dhcp/omapip/mrtrace.c,v retrieving revision 1.1.1.2 diff -u -r1.1.1.2 mrtrace.c --- omapip/mrtrace.c 26 Jun 2004 10:34:24 -0000 1.1.1.2 +++ omapip/mrtrace.c 28 Jun 2004 11:18:26 -0000 @@ -61,7 +61,7 @@ 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 () --=-=-=--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpfz8fy64p.fsf>