Date: Mon, 28 Jun 2004 13:20:25 +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: <xzp1xk0ylmu.fsf@dwp.des.no> In-Reply-To: <20040627160033.G75210@ida.interface-business.de> (Joerg Wunsch's message of "Sun, 27 Jun 2004 16:00:33 %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>
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: > 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 <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 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 <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?xzp1xk0ylmu.fsf>