Subject: Re: NetBSD-3 NIS-compat getpwnam()/getpwuid iterate entire map [was Re: 3.0 YP lookup latency]
To: Christos Zoulas <christos@zoulas.com>
From: Charles M. Hannum <mycroft@MIT.EDU>
List: tech-net
Date: 06/21/2006 18:11:19
On Wed, Jun 21, 2006 at 04:19:34PM -0400, Christos Zoulas wrote:
> | Oh... and I noticed a bug in clnt_generic(): for RPC-over-TCP, we
> | disable RFC-896 (Nagle) processing for TCP over IPv4, but not for TCP
> | over IPv6[1].  Makes a grown man cry.
> 
> And something like this?
> 
> Index: clnt_generic.c
> ===================================================================
> RCS file: /cvsroot/src/lib/libc/rpc/clnt_generic.c,v
> retrieving revision 1.25
> diff -u -u -r1.25 clnt_generic.c
> --- clnt_generic.c	2 Dec 2005 12:19:16 -0000	1.25
> +++ clnt_generic.c	21 Jun 2006 20:19:15 -0000
> @@ -333,10 +333,8 @@
>  		cl = clnt_vc_create(fd, svcaddr, prog, vers, sendsz, recvsz);
>  		if (!nconf || !cl)
>  			break;
> -		/* XXX fvdl - is this useful? */
> -		if (strncmp(nconf->nc_protofmly, "inet", (size_t)4) == 0)
> -			setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &one,
> -			    (socklen_t)sizeof (one));
> +		setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &one,
> +		    (socklen_t)sizeof (one));
>  		break;
>  	case NC_TPI_CLTS:
>  		cl = clnt_dg_create(fd, svcaddr, prog, vers, sendsz, recvsz);

This is a fine example of why you should not be so hasty to "fix"
things.  If you type "man strncmp" and read a bit, you'll understand
that the original code matches both "inet" and "inet6" -- and the bug
that Jonathan claimed above *does not exist*.

Furthermore, since protocol numbers are unique within a protocol
family (at least in BSD), the code as written will not have any
adverse effect on non-TCP stream sockets, even if such should exist
some day in the AF_INET or AF_INET6 protocol families.

Please to be working on real bugs, not fictional ones.