From owner-freebsd-net Thu May 10 9:24: 7 2001 Delivered-To: freebsd-net@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id B0AC637B422 for ; Thu, 10 May 2001 09:24:03 -0700 (PDT) (envelope-from bright@fw.wintelcom.net) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id f4AGO1h24968; Thu, 10 May 2001 09:24:01 -0700 (PDT) Date: Thu, 10 May 2001 09:24:01 -0700 From: Alfred Perlstein To: Garrett Wollman Cc: net@FreeBSD.ORG Subject: Re: getaddrinfo irritation Message-ID: <20010510092401.M18676@fw.wintelcom.net> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i 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 X-all-your-base: are belong to us. Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org * Garrett Wollman [010510 09:13] wrote: > < 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