MIME-Version: 1.0 (Apple Message framework v936) In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Mailer: Apple Mail (2.936) References: <4C812D59.50503@redhat.com> Message-ID: Content-Type: text/plain; charset="utf-8"; delsp="yes"; format="flowed" X-RT-Original-Encoding: utf-8 Received: from mx.ams1.isc.org (mx.ams1.isc.org [199.6.1.65]) by bugs.isc.org (Postfix) with ESMTP id ABDB120EE275 for ; Fri, 3 Sep 2010 17:55:10 +0000 (UTC) Received: from farside.isc.org (farside.isc.org [IPv6:2001:4f8:3:bb::5]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "farside.isc.org", Issuer "ISC CA" (verified OK)) by mx.ams1.isc.org (Postfix) with ESMTPS id BAE195F9865 for ; Fri, 3 Sep 2010 17:54:55 +0000 (UTC) (envelope-from larissas@isc.org) Received: from [IPv6:2001:4f8:3:65:211:24ff:fe23:2759] (unknown [IPv6:2001:4f8:3:65:211:24ff:fe23:2759]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client did not present a certificate) by farside.isc.org (Postfix) with ESMTP id E9DADE6030 for ; Fri, 3 Sep 2010 17:54:53 +0000 (UTC) (envelope-from larissas@isc.org) Delivered-To: dhcp-bugs@bugs.isc.org Subject: Re: [ISC-Bugs #22033] dhcp-4.2.0 uses int for handling time values Return-Path: X-Original-To: dhcp-bugs@bugs.isc.org Date: Fri, 3 Sep 2010 10:54:53 -0700 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mx.ams1.isc.org To: dhcp-bugs@isc.org Content-Transfer-Encoding: 7bit From: Larissa Shapiro RT-Message-ID: Content-Length: 2992 Hi Jiri, Thanks for the patch. Our guys will review and we will get back to you asap as to if we can include this in an upcoming release or not. Best Regards, Larissa ISC Product Manager On Sep 3, 2010, at 10:16 AM, Jiri Popelka via RT wrote: > > Fri Sep 03 17:16:21 2010: Request 22033 was acted upon. > Transaction: Ticket created by jpopelka@redhat.com > Queue: dhcp > Subject: dhcp-4.2.0 uses int for handling time values > Owner: Nobody > Requestors: jpopelka@redhat.com > Status: new > Ticket > ----------------------------------------------------------------------- > > Hello there in ISC, > > There can be one small improvement in the newly (dhcp-4.2.0) added > code. > In common/dispatch.c the add_timeout() function was slightly modified. > Problem is that the newly added code uses > int sec, usec; > for manipulating with time values, e.g. > sec = when->tv_sec - cur_tv.tv_sec > > This can cause problems on 64bit machines when some crazy server sends > huge values of lease-time/renewal-time/rebinding-time. > For real example see > https://bugzilla.redhat.com/show_bug.cgi?id=628258 > > Attached is patch that fixes it. > Regards > > Jiri Popelka > Red Hat, inc. > > diff -up dhcp-4.2.0/common/dispatch.c.time dhcp-4.2.0/common/ > dispatch.c > --- dhcp-4.2.0/common/dispatch.c.time 2010-06-01 19:29:59.000000000 > +0200 > +++ dhcp-4.2.0/common/dispatch.c 2010-09-03 18:30:08.000000000 +0200 > @@ -185,7 +185,7 @@ void add_timeout (when, where, what, ref > struct timeout *t, *q; > int usereset = 0; > isc_result_t status; > - int sec, usec; > + struct timeval relative_time; > isc_interval_t interval; > isc_time_t expires; > > @@ -293,24 +293,24 @@ void add_timeout (when, where, what, ref > * about the usec value, if it's zero we assume the caller didn't > care. > */ > > - sec = when->tv_sec - cur_tv.tv_sec; > - usec = when->tv_usec - cur_tv.tv_usec; > + relative_time.tv_sec = when->tv_sec - cur_tv.tv_sec; > + relative_time.tv_usec = when->tv_usec - cur_tv.tv_usec; > > - if ((when->tv_usec != 0) && (usec < 0)) { > - sec--; > - usec += USEC_MAX; > + if ((when->tv_usec != 0) && (relative_time.tv_usec < 0)) { > + relative_time.tv_sec--; > + relative_time.tv_usec += USEC_MAX; > } > > - if (sec < 0) { > - sec = 0; > - usec = 0; > - } else if (usec < 0) { > - usec = 0; > - } else if (usec >= USEC_MAX) { > - usec = USEC_MAX - 1; > + if (relative_time.tv_sec < 0) { > + relative_time.tv_sec = 0; > + relative_time.tv_usec = 0; > + } else if (relative_time.tv_usec < 0) { > + relative_time.tv_usec = 0; > + } else if (relative_time.tv_usec >= USEC_MAX) { > + relative_time.tv_usec = USEC_MAX - 1; > } > > - isc_interval_set(&interval, sec, usec * 1000); > + isc_interval_set(&interval, relative_time.tv_sec, > relative_time.tv_usec * 1000); > status = isc_time_nowplusinterval(&expires, &interval); > if (status != ISC_R_SUCCESS) { > /*