Date: Thu, 10 May 2001 09:24:01 -0700 From: Alfred Perlstein <bright@wintelcom.net> To: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> Cc: net@FreeBSD.ORG Subject: Re: getaddrinfo irritation Message-ID: <20010510092401.M18676@fw.wintelcom.net> In-Reply-To: <200105101612.MAA81594@khavrinen.lcs.mit.edu>; from wollman@khavrinen.lcs.mit.edu on Thu, May 10, 2001 at 12:12:59PM -0400 References: <20010510082025.J18676@fw.wintelcom.net> <200105101540.LAA81367@khavrinen.lcs.mit.edu> <20010510090322.K18676@fw.wintelcom.net> <20010510090907.L18676@fw.wintelcom.net> <200105101612.MAA81594@khavrinen.lcs.mit.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
* Garrett Wollman <wollman@khavrinen.lcs.mit.edu> [010510 09:13] wrote: > <<On Thu, 10 May 2001 09:09:07 -0700, Alfred Perlstein <bright@wintelcom.net> said: > > > Shouldn't it do the mapping of addrhint.ai_protocol=6 (tcp) > > into ai_socktype = SOCK_STREAM? > > No. In the socket model, the protocol is subordinate to the type of > socket. (For example, XNS SPP can implements both SOCK_SEQPACKET and > SOCK_STREAM.) Ugh, and just when I thought I had it licked... Index: getaddrinfo.c =================================================================== RCS file: /home/ncvs/src/lib/libc/net/getaddrinfo.c,v retrieving revision 1.20 diff -u -r1.20 getaddrinfo.c --- getaddrinfo.c 2001/03/17 14:25:23 1.20 +++ getaddrinfo.c 2001/05/10 16:25:10 @@ -415,6 +415,18 @@ } } } + /* + * If only protocol is supplied then lookup socktype + */ + else if (pai->ai_protocol != ANY) { + for (ex = explore; ex->e_af >= 0; ex++) { + if (pai->ai_protocol == ex->e_protocol) { + pai->ai_socktype = ex->e_socktype; + break; + } + } + } + } /* I guess this is a no-no then? It tries to match the protocol with the socktype. -- -Alfred Perlstein - [alfred@freebsd.org] Daemon News Magazine in your snail-mail! http://magazine.daemonnews.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010510092401.M18676>