Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Feb 2004 11:45:52 +0100
From:      des@des.no (Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?=)
To:        Garance A Drosihn <drosih@rpi.edu>
Cc:        sparc64@freebsd.org
Subject:   Re: Problem with DHCLIENT vs 64-bit time_t
Message-ID:  <xzpznbbwfxb.fsf@dwp.des.no>
In-Reply-To: <p06020466bc5e09bf7182@[128.113.24.47]> (Garance A. Drosihn's message of "Sun, 22 Feb 2004 02:59:26 -0500")
References:  <p06020407bc533f0ae9d2@[128.113.24.47]> <20040215060047.GA62840@dhcp01.pn.xcllnt.net> <p0602040ebc54c885236b@[128.113.24.47]> <20040215165913.M30161@grogged.dyndns.org> <p06020425bc571c20bcde@[128.113.24.47]> <p06020466bc5e09bf7182@[128.113.24.47]>

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

Garance A Drosihn <drosih@rpi.edu> 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);
 }

--=-=-=--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpznbbwfxb.fsf>