bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gnulib] Incomplete getaddrinfo module


From: Yoann Vandoorselaere
Subject: Re: [bug-gnulib] Incomplete getaddrinfo module
Date: Thu, 15 Sep 2005 17:01:44 +0200

On Thu, 2005-09-15 at 10:41 -0400, Derek Price wrote:
> Yoann Vandoorselaere wrote:
> 
> >>>  if (hints && (hints->ai_flags & ~AI_CANONNAME))
> >>>    /* FIXME: Support more flags. */
> >>>    return EAI_BADFLAGS;
> >>>      
> >>>
> >>If you say which flags your application needs to work, maybe Simon can
> >>do something about it?
> >>    
> >>
> >
> >For my own use, I simply remove this check. This is due to the use of
> >AI_PASSIVE or AI_ADDRCONFIG, which can not easily be implemented without
> >very specific support.
> >  
> >
> 
> I don't like the idea of silently ignoring flags that are not
> implemented to POSIX specifications.  At the least, any ignored flags
> that make it into the GNULIB module deserve a healthy comment about any
> potential dangers and why it was deemed worthwhile to ignore the flag
> rather than adding an implementation up to POSIX specs.

I think these flags are part of POSIX. Quote from the POSIX manpage:

If  the  AI_ADDRCONFIG flag is specified, IPv4 addresses shall be
returned only if an IPv4 address is configured on the local system, and
IPv6 addresses shall be returned only if an IPv6 address is configured
on the local system.

If the AI_PASSIVE flag is specified, the returned address information
shall be suitable for use in binding  a  socket  for  accepting incoming
connections  for  the specified service. In this case, if the nodename
argument is null, then the IP address portion of the socket address
structure shall be set to INADDR_ANY for an IPv4 address or
IN6ADDR_ANY_INIT for an IPv6 address.  (...)


> >>>This is not right since it tend to break application that trust the
> >>>GnuLib module to provide a viable getaddrinfo replacement.
> >>>      
> >>>
> >>I agree. If we provide a function in gnulib, it should attempt to be an as
> >>complete replacement for the standard one as possible.
> >>    
> >>
> 
> As long as, "possible," means that someone has submitted a patch
> containing proposed enhancements and not that function replacements
> without a full POSIX implementation need to be backed out, though I
> agree that incomplete implementations may deserve a note about their
> incompleteness in the docs.
> 
> As things stand, the GNULIB getaddrinfo provides enough functionality,
> at the least, for CVS, canon-host as used by coreutils, and I believe
> one of Simon's applications (please forgive me for forgetting where you
> have this installed, Simon).  These applications simply don't request
> the information that is not available from the GNULIB getaddrinfo, not
> because it isn't implemented, but because the applications have no need,
> I presume.  I know that this is true in the case of CVS.

As an example, libprelude will break with GnuLib getaddrinfo due to the
usage of the AI_ADDRCONFIG option (if available), and AI_PASSIVE.

-- 
Yoann Vandoorselaere <address@hidden>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]