From owner-freebsd-sparc64@FreeBSD.ORG Mon Jun 28 16:55:38 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7E43816A4CE for ; Mon, 28 Jun 2004 16:55:38 +0000 (GMT) Received: from smtp.des.no (flood.des.no [217.116.83.31]) by mx1.FreeBSD.org (Postfix) with ESMTP id 727FF43D48 for ; Mon, 28 Jun 2004 16:55:37 +0000 (GMT) (envelope-from des@des.no) Received: by smtp.des.no (Pony Express, from userid 666) id 198D4530C; Mon, 28 Jun 2004 18:55:35 +0200 (CEST) Received: from dwp.des.no (des.no [80.203.228.37]) by smtp.des.no (Pony Express) with ESMTP id 94843530A; Mon, 28 Jun 2004 18:55:18 +0200 (CEST) Received: by dwp.des.no (Postfix, from userid 2602) id 71951B86C; Mon, 28 Jun 2004 18:55:18 +0200 (CEST) To: Joerg Wunsch 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> <20040628160937.D21248@ida.interface-business.de> From: des@des.no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=) Date: Mon, 28 Jun 2004 18:55:18 +0200 In-Reply-To: <20040628160937.D21248@ida.interface-business.de> (Joerg Wunsch's message of "Mon, 28 Jun 2004 16:09:37 +0200") Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on flood.des.no X-Spam-Level: X-Spam-Status: No, hits=0.0 required=5.0 tests=AWL autolearn=no version=2.63 cc: dhcp-hackers@isc.org cc: sparc64@freebsd.org Subject: Re: 64-bit time_t safe lease time X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2004 16:55:38 -0000 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Joerg Wunsch 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 #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 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 () --=-=-=--