Subject: Re: accepting both ipv4 and v6 connections
To: None <tech-net@NetBSD.org>
From: Jeff Rizzo <riz@boogers.sf.ca.us>
List: tech-net
Date: 05/12/2004 09:55:00
On Wed, May 12, 2004 at 05:11:41PM +0200, Ignatios Souvatzis wrote:
> On Wed, May 12, 2004 at 08:06:07AM -0700, Jeff Rizzo wrote:
> > 
> > Just as a followup question, is the "correct" way to support both
> > ipv4 and ipv6 in a case like this to loop over the return
> > from getaddrinfo() and bind a listening fd to both :: and 0.0.0.0 ?
> > That is, always handle all protocols explicitly?
> 
> That's the protocol-independent version.
> 
> The other one only handles IPv4 and IPv6, and will fail in other situations
> where getaddrinfo might find more than one address per AF.

I'm not certain I follow what you mean here.  IIUC, since there
was an AI_PASSIVE hint given to getaddrinfo(), it should only return
one address per AF in this case, the "wildcard" address.  This
much, at least, seems to be working.



-- 
Jeff Rizzo                                         http://boogers.sf.ca.us/~riz