From owner-freebsd-sparc64@FreeBSD.ORG Mon Jun 28 11:20:54 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 895CC16A4CE for ; Mon, 28 Jun 2004 11:20:54 +0000 (GMT) Received: from smtp.des.no (flood.des.no [217.116.83.31]) by mx1.FreeBSD.org (Postfix) with ESMTP id A889A43D3F for ; Mon, 28 Jun 2004 11:20:53 +0000 (GMT) (envelope-from des@des.no) Received: by smtp.des.no (Pony Express, from userid 666) id 1E50F530C; Mon, 28 Jun 2004 13:20:42 +0200 (CEST) Received: from dwp.des.no (des.no [80.203.228.37]) by smtp.des.no (Pony Express) with ESMTP id 510D9530A; Mon, 28 Jun 2004 13:20:26 +0200 (CEST) Received: by dwp.des.no (Postfix, from userid 2602) id 04AF5B86C; Mon, 28 Jun 2004 13:20:26 +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> From: des@des.no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=) Date: Mon, 28 Jun 2004 13:20:25 +0200 In-Reply-To: <20040627160033.G75210@ida.interface-business.de> (Joerg Wunsch's message of "Sun, 27 Jun 2004 16:00:33 +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 11:20:54 -0000 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Joerg Wunsch writes: > The problem was that GET_TIME() (first called in script_go()) > clobbered part of sockaddr_broadcast. The memory area it clobbers > looks a bit surprising to me, but the actual error became obvious > then: calling time() on a TIME* object, when sizeof(time_t) !=3D > sizeof(TIME) is just an error. your analysis does not jibe with my reading of the code, since TIME is defined as time_t: #define TIME time_t #define GET_TIME(x) time ((x)) there's nothing wrong with this as long as the argument to GET_TIME() is always a TIME (or time_t). GET_TIME() is called in three places, always with &cur_time as argument. cur_time is defined as a TIME in dhclient, and redefined as an int32_t in libomapip (which is linked statically into dhclient). The fact that it is defined twice is probably a bug; the fact that the linker does not warn about this is probably a bug, too. The attached patch addresses these inconsistencies, but I have not verified that it corrects the 64-bit time_t problem. DES --=20 Dag-Erling Sm=F8rgrav - des@des.no --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=cur_time.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 11:16:41 -0000 @@ -95,7 +95,6 @@ struct timeval *tvp_new; #endif isc_result_t status; - TIME cur_time; tvp = NULL; #ifdef ENABLE_POLLING_MODE 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 () --=-=-=--