Subject: lib/15596: inet_makeaddr(3) LP64 problem
To: None <gnats-bugs@gnats.netbsd.org>
From: None <minoura@netbsd.org>
List: netbsd-bugs
Date: 02/13/2002 19:58:49
>Number:         15596
>Category:       lib
>Synopsis:       inet_makeaddr(3) LP64 problem
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 13 02:57:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Minoura Makoto
>Release:        NetBSD 1.5ZA
>Organization:
The NetBSD Project
>Environment:
System: NetBSD plute 1.5ZA NetBSD 1.5ZA (PLUTE) #1: Sat Feb 9 16:17:25 JST 2002 root@plute:/usr/obj/sys/arch/sparc64/compile/PLUTE sparc64
Architecture: sparc64
Machine: sparc64
>Description:
inet_makeaddr(3) has a big-endian LP64 problem.
>How-To-Repeat:
Specify numeric IP addresses in /etc/exports, start mountd and try to
mount from a remote host.

Example /etc/exports
/		-network 192.168 -mask 255.255.0.0 -alldirs

>Fix:
Index: basesrc/lib/libc/net/inet_makeaddr.c
===================================================================
RCS file: /cvsroot/basesrc/lib/libc/net/inet_makeaddr.c,v
retrieving revision 1.8
diff -u -r1.8 inet_makeaddr.c
--- basesrc/lib/libc/net/inet_makeaddr.c	2000/01/22 22:19:15	1.8
+++ basesrc/lib/libc/net/inet_makeaddr.c	2002/02/13 10:48:21
@@ -59,7 +59,7 @@
 inet_makeaddr(net, host)
 	u_long net, host;
 {
-	u_long addr;
+	in_addr_t addr;
 
 	if (net < 128)
 		addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST);
@@ -69,6 +69,6 @@
 		addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST);
 	else
 		addr = net | host;
-	addr = htonl((u_int32_t)addr);
+	addr = htonl(addr);
 	return (*(struct in_addr *)(void *)&addr);
 }
>Release-Note:
>Audit-Trail:
>Unformatted:
 retrieved on 2002.2.5