Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 May 2001 09:09:07 -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:  <20010510090907.L18676@fw.wintelcom.net>
In-Reply-To: <20010510090322.K18676@fw.wintelcom.net>; from bright@wintelcom.net on Thu, May 10, 2001 at 09:03:22AM -0700
References:  <20010510082025.J18676@fw.wintelcom.net> <200105101540.LAA81367@khavrinen.lcs.mit.edu> <20010510090322.K18676@fw.wintelcom.net>

next in thread | previous in thread | raw e-mail | index | archive | help
* Alfred Perlstein <bright@wintelcom.net> [010510 09:04] wrote:
> * Garrett Wollman <wollman@khavrinen.lcs.mit.edu> [010510 08:41] wrote:
> > <<On Thu, 10 May 2001 08:20:26 -0700, Alfred Perlstein <bright@wintelcom.net> said:
> > 
> > > Using "our" APIs (getaddrinfo) is causing me much pain because I can't
> > > figure out how to map "tcp" -> SOCK_STREAM.
> > 
> > You don't.  In the `hints' structure, you pass in ai_socktype ==
> > SOCK_STREAM.  This is clearly documented in the manual page.
> 
> Duh. :)
> 
> What I mean is how would one map:  localhost:http:tcp into that?
> 
> There seems to be no way to determine what I must do to ai_socktype
> based on the above string.
> 
> Do I have to roll my own lookup code?

What I'm trying is something like this:

	if (proto != NULL) {
		struct protoent *protoent;

		protoent = getprotobyname(proto);
		if (protoent != NULL)
			addrhint.ai_protocol = protoent->p_proto;
		else
			log_error("getprotobyname(%s)", proto);
	}

	error = getaddrinfo(addr, service, &addrhint, &addrinfo);

Shouldn't it do the mapping of addrhint.ai_protocol=6 (tcp)
into ai_socktype = SOCK_STREAM?

Isn't this a bug of some sorts?

-- 
-Alfred Perlstein - [alfred@freebsd.org]
Represent yourself, show up at BABUG http://www.babug.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?20010510090907.L18676>