This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/7079] New: when use getnameinfo() with IPv6 unspecified address,[EAI_NONAME] error should be returned


RFC 3493 said:
6.2 Socket Address Structure to Node Name and Service Name

Note: The IPv6 unspecified address ("::") and the IPv6 loopback
      address ("::1") are not IPv4-compatible addresses.  If the address
      is the IPv6 unspecified address ("::"), a lookup is not performed,
      and the [EAI_NONAME] error is returned.

But the glibc do not check if the address is the IPv6 unspecified address
and return [EAI_NONAME] error.

Here is an attached patch:
---
 getnameinfo.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c
index 5024038..f172fda 100644
--- a/inet/getnameinfo.c
+++ b/inet/getnameinfo.c
@@ -191,6 +191,8 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen,
char *host,
     case AF_INET6:
       if (addrlen < sizeof (struct sockaddr_in6))
 	return EAI_FAMILY;
+      if ( IN6_IS_ADDR_UNSPECIFIED(&((const struct sockaddr_in6 *)
sa)->sin6_addr) )
+        return EAI_NONAME;
       break;
     default:
       return EAI_FAMILY;
-- 
1.5.3.8

-- 
           Summary: when use getnameinfo() with IPv6 unspecified
                    address,[EAI_NONAME] error should be returned
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: yanghy at cn dot fujitsu dot com
                CC: glibc-bugs at sources dot redhat dot com,yanghy at cn
                    dot fujitsu dot com


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

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]