YP didn't work on my sparc64 testbox here until I crafted this patch. It's a simple combination of an endian problem on an arch where sizeof(long) != sizeof(IPv4 address). The patch can be found at http://www.freebsd.org/~jhb/patches/yp.patch and below:
I've tested it on both sparc64 and i386. Both work fine. sparc64 didn't work prior to this. Unfortunately, my mailer is going to butcher it, so you probably want to fetch the version above. I'd like to commit it unless there are objections. Index: yplib.c =================================================================== RCS file: /usr/cvs/src/lib/libc/yp/yplib.c,v retrieving revision 1.36 diff -u -r1.36 yplib.c --- yplib.c 23 May 2001 15:37:10 -0000 1.36 +++ yplib.c 8 Jan 2002 10:30:39 -0000 @@ -402,10 +402,12 @@ bzero(&ysd->dom_server_addr, sizeof ysd->dom_server_addr); ysd->dom_server_addr.sin_family = AF_INET; ysd->dom_server_addr.sin_len = sizeof(struct sockaddr_in); - ysd->dom_server_addr.sin_addr.s_addr = - *(u_long *)&ybr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr; - ysd->dom_server_addr.sin_port = - *(u_short *)&ybr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port; + bcopy(&ybr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr, + &ysd->dom_server_addr.sin_addr.s_addr, + sizeof(ysd->dom_server_addr.sin_addr.s_addr)); + bcopy(&ybr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port, + &ysd->dom_server_addr.sin_port, + sizeof(ysd->dom_server_addr.sin_port)); ysd->dom_server_port = ysd->dom_server_addr.sin_port; _close(fd); @@ -497,10 +499,12 @@ bzero((char *)&ysd->dom_server_addr, sizeof ysd->dom_server_addr); ysd->dom_server_addr.sin_family = AF_INET; - ysd->dom_server_addr.sin_port = - *(u_short *)&ypbr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port; - ysd->dom_server_addr.sin_addr.s_addr = - *(u_long *)&ypbr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr; + bcopy(&ypbr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port, + &ysd->dom_server_addr.sin_port, + sizeof(ysd->dom_server_addr.sin_port)); + bcopy(&ypbr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr, + &ysd->dom_server_addr.sin_addr.s_addr, + sizeof(ysd->dom_server_addr.sin_addr.s_addr)); /* * We could do a reserved port check here too, but this -- John Baldwin <[EMAIL PROTECTED]> <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message