Subject: bin/15641: dhclient(8) has a LP64 problem.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <ura@hiru.aoba.yokohama.jp>
List: netbsd-bugs
Date: 02/17/2002 19:11:59
>Number:         15641
>Category:       bin
>Synopsis:       dhclient(8) has a LP64 problem.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 17 02:14:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     URA Hiroshi
>Release:        NetBSD 1.5ZA
>Organization:
>Environment:
NetBSD classic.soum.co.jp 1.5ZA NetBSD 1.5ZA (BLADE100) #111: Thu Feb 14 19:56:34 JST 2002     ura@classic.soum.co.jp:/usr/src/sys/arch/sparc64/compile/BLADE100 sparc64
Architecture: sparc64
Machine: sparc64
>Description:

	dhclient(8) uses invaild broadcast address and too big renewal time 
	when running on NetBSD/sparc64.

	In this following case, it display 172.19.0.0 and 1133550515 sec. 
	instead of 172.19.255.255. and about 300 sec. 

# dhclient -d gem0
Internet Software Consortium DHCP Client V3.0rc10
Copyright 1995-2001 Internet Software Consortium.
All rights reserved.
For info, please visit http://www.isc.org/products/DHCP

Listening on BPF/gem0/00:03:ba:00:c2:68
Sending on   BPF/gem0/00:03:ba:00:c2:68
Sending on   Socket/fallback
DHCPREQUEST on gem0 to 255.255.255.255 port 67
ip length 328 disagrees with bytes received 332.
accepting packet with data after udp payload.
DHCPACK from 172.19.2.3
New Network Number: 172.19.0.0
New Broadcast Address: 0.0.0.0
bound to 172.19.201.46 -- renewal in 1133550515 seconds.

	dhclient(8) w/ the below patch display vaild values.

# ./dhclient -d gem0
Internet Software Consortium DHCP Client V3.0rc10
Copyright 1995-2001 Internet Software Consortium.
All rights reserved.
For info, please visit http://www.isc.org/products/DHCP

Listening on BPF/gem0/00:03:ba:00:c2:68
Sending on   BPF/gem0/00:03:ba:00:c2:68
Sending on   Socket/fallback
DHCPREQUEST on gem0 to 255.255.255.255 port 67
ip length 328 disagrees with bytes received 332.
accepting packet with data after udp payload.
DHCPACK from 172.19.2.3
New Network Number: 172.19.0.0
New Broadcast Address: 172.19.255.255
bound to 172.19.201.46 -- renewal in 243 seconds.
DHCPREQUEST on gem0 to 172.19.2.3 port 67
ip length 328 disagrees with bytes received 332.
accepting packet with data after udp payload.
DHCPACK from 172.19.2.3
New Network Number: 172.19.0.0
New Broadcast Address: 172.19.255.255
bound to 172.19.201.46 -- renewal in 251 seconds.


>How-To-Repeat:
	try dhclient

>Fix:
	apply this patch.

Index: convert.c
===================================================================
RCS file: /cvsroot/netbsd/basesrc/dist/dhcp/omapip/convert.c,v
retrieving revision 1.1
diff -u -u -r1.1 convert.c
--- convert.c	2001/08/03 11:35:37	1.1
+++ convert.c	2002/02/17 08:12:26
@@ -52,7 +52,7 @@
 u_int32_t getULong (buf)
 	const unsigned char *buf;
 {
-	unsigned long ibuf;
+	u_int32_t ibuf;
 
 	memcpy (&ibuf, buf, sizeof (u_int32_t));
 	return ntohl (ibuf);
@@ -61,7 +61,7 @@
 int32_t getLong (buf)
 	const unsigned char *buf;
 {
-	long ibuf;
+	int32_t ibuf;
 
 	memcpy (&ibuf, buf, sizeof (int32_t));
 	return ntohl (ibuf);
@@ -70,7 +70,7 @@
 u_int32_t getUShort (buf)
 	const unsigned char *buf;
 {
-	unsigned short ibuf;
+	u_int16_t ibuf;
 
 	memcpy (&ibuf, buf, sizeof (u_int16_t));
 	return ntohs (ibuf);
@@ -79,7 +79,7 @@
 int32_t getShort (buf)
 	const unsigned char *buf;
 {
-	short ibuf;
+	int16_t ibuf;
 
 	memcpy (&ibuf, buf, sizeof (int16_t));
 	return ntohs (ibuf);
>Release-Note:
>Audit-Trail:
>Unformatted: