public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/1774] New: Incorrect handling of AI_ALL in getaddrinfo()
@ 2005-11-01 12:27 klimes at centrum dot cz
  2005-11-01 12:29 ` [Bug libc/1774] " klimes at centrum dot cz
  2005-11-03 18:55 ` drepper at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: klimes at centrum dot cz @ 2005-11-01 12:27 UTC (permalink / raw)
  To: glibc-bugs

getaddrinfo() implementation in glibc does not conform with POSIX in regards
with AI_ALL flag.

If address family is AF_INET6 and flags are AI_ALL | AI_V4MAPPED, getaddrinfo()
should return all IPv6 address _and_ all IPv4 adresses (as IPv4-mapped ones).
However glibc implementation returns only IPV6 adresses (if they exists).

I use glibc-2.3.5 of Fedora Core 4, but looking at getaddrinfo.c source, the
behaviour applies on latest version as well.

In my opinion the condition at line 632 of getaddrinfo.c (revision 1.81.2.4.2.1)
is not correct.
/* If we do not have to look for IPv4 and IPv6 together, use
    the simple, old functions.  */
632:  if (req->ai_family == AF_INET || req->ai_family == AF_INET6)

because resolution on IPV4 adresses must be performed even if family is
AF_INET6, when AI_ALL flag is used in conjunction with AI_V4MAPPED.

-----------------------------------------------------------------------------
Citation from POSIX (contained in rfc3493 as well):
If the AI_V4MAPPED flag is specified along with an ai_family of AF_INET6, then
getaddrinfo() shall return IPv4-mapped IPv6 addresses on finding no matching
IPv6 addresses ( ai_addrlen shall be 16). The AI_V4MAPPED flag shall be ignored
unless ai_family equals AF_INET6. If the AI_ALL flag is used with the
AI_V4MAPPED flag, then getaddrinfo() shall return all matching IPv6 and IPv4
addresses. The AI_ALL flag without the AI_V4MAPPED flag is ignored.
-------------------------------------------------------------------------------

In the attachment there is a test program getaddrinfo_AI_ALL.c, which test the
AI_ALL | AI_V4MAPPED combination.
When called ./getaddinfo_AI_ALL www.kame.net
it returns IPv6 address, but with correct getaddrinfo() it should return
IPv4-mapped IPv6.

-- 
           Summary: Incorrect handling of AI_ALL in getaddrinfo()
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: klimes at centrum dot cz
                CC: glibc-bugs at sources dot redhat dot com,klimes at
                    centrum dot cz


http://sourceware.org/bugzilla/show_bug.cgi?id=1774

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libc/1774] Incorrect handling of AI_ALL in getaddrinfo()
  2005-11-01 12:27 [Bug libc/1774] New: Incorrect handling of AI_ALL in getaddrinfo() klimes at centrum dot cz
@ 2005-11-01 12:29 ` klimes at centrum dot cz
  2005-11-03 18:55 ` drepper at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: klimes at centrum dot cz @ 2005-11-01 12:29 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From klimes at centrum dot cz  2005-11-01 12:29 -------
Created an attachment (id=732)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=732&action=view)
test program for AI_ALL flag in getaddrinfo()


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=1774

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libc/1774] Incorrect handling of AI_ALL in getaddrinfo()
  2005-11-01 12:27 [Bug libc/1774] New: Incorrect handling of AI_ALL in getaddrinfo() klimes at centrum dot cz
  2005-11-01 12:29 ` [Bug libc/1774] " klimes at centrum dot cz
@ 2005-11-03 18:55 ` drepper at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: drepper at redhat dot com @ 2005-11-03 18:55 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2005-11-03 18:55 -------
Fixed in the CVS trunk.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://sourceware.org/bugzilla/show_bug.cgi?id=1774

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-11-03 18:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-01 12:27 [Bug libc/1774] New: Incorrect handling of AI_ALL in getaddrinfo() klimes at centrum dot cz
2005-11-01 12:29 ` [Bug libc/1774] " klimes at centrum dot cz
2005-11-03 18:55 ` drepper at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).