From owner-freebsd-sparc64@FreeBSD.ORG Sun Feb 22 03:04:37 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 3865216A4F2 for ; Sun, 22 Feb 2004 03:04:37 -0800 (PST) Received: from smtp.des.no (flood.des.no [217.116.83.31]) by mx1.FreeBSD.org (Postfix) with ESMTP id 06D4C43D1D for ; Sun, 22 Feb 2004 03:04:37 -0800 (PST) (envelope-from des@des.no) Received: by smtp.des.no (Pony Express, from userid 666) id CEC1E530D; Sun, 22 Feb 2004 11:46:00 +0100 (CET) Received: from dwp.des.no (des.no [80.203.228.37]) by smtp.des.no (Pony Express) with ESMTP id 1851D5308; Sun, 22 Feb 2004 11:45:53 +0100 (CET) Received: by dwp.des.no (Postfix, from userid 2602) id EBE7033C6F; Sun, 22 Feb 2004 11:45:52 +0100 (CET) To: Garance A Drosihn References: <20040215060047.GA62840@dhcp01.pn.xcllnt.net> <20040215165913.M30161@grogged.dyndns.org> From: des@des.no (Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?=) Date: Sun, 22 Feb 2004 11:45:52 +0100 In-Reply-To: (Garance A. Drosihn's message of "Sun, 22 Feb 2004 02:59:26 -0500") Message-ID: User-Agent: Gnus/5.090024 (Oort Gnus v0.24) 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: sparc64@freebsd.org Subject: Re: Problem with DHCLIENT vs 64-bit time_t 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: Sun, 22 Feb 2004 11:04:37 -0000 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Garance A Drosihn writes: > So, there definitely is something wrong with the dhclient from > the base system But it might be that people having trouble with > dhcp on 64-bTT sparc systems could use the port, at least for > the short-term. Only takes a few minutes of eyeballing to figure out that the problem is most likely on line 424 of src/contrib/isc-dhcp/common/parse.c: convert_num (cfile, (unsigned char *)timep, val, 10, 32); idiotically, the final argument to convert_num() is supposed to be the size in bits of the number to store in the location pointed to by the second argument. The simplest fix is to use a temporary int32_t and assign it to *timep later, since convert_num() can't deal with 64-bit quantities. See attached (untested) patch. DES --=20 Dag-Erling Sm=F8rgrav - des@des.no --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=dhclient.diff Index: contrib/isc-dhcp/common/parse.c =================================================================== RCS file: /home/ncvs/src/contrib/isc-dhcp/common/parse.c,v retrieving revision 1.1.1.8 diff -u -r1.1.1.8 parse.c --- contrib/isc-dhcp/common/parse.c 2 Sep 2003 11:01:23 -0000 1.1.1.8 +++ contrib/isc-dhcp/common/parse.c 22 Feb 2004 10:44:52 -0000 @@ -414,6 +414,7 @@ { const char *val; enum dhcp_token token; + int32_t num; token = next_token (&val, (unsigned *)0, cfile); if (token != NUMBER) { @@ -421,9 +422,9 @@ skip_to_semi (cfile); return; } - convert_num (cfile, (unsigned char *)timep, val, 10, 32); + convert_num (cfile, (unsigned char *)&num, val, 10, 32); /* Unswap the number - convert_num returns stuff in NBO. */ - *timep = ntohl (*timep); /* XXX */ + *timep = ntohl (num); parse_semi (cfile); } --=-=-=--