apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 57024] New: handle getaddrinfo() AF_UNSPEC quirk on z/OS
Date Fri, 26 Sep 2014 17:42:16 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=57024

            Bug ID: 57024
           Summary: handle getaddrinfo()  AF_UNSPEC quirk on z/OS
           Product: APR
           Version: HEAD
          Hardware: PC
                OS: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: APR
          Assignee: bugs@apr.apache.org
          Reporter: covener@gmail.com

We have observed that z/OS uniquely does not return IPv4 results to a
getaddrinfo call with a family of AF_UNSPEC when there are 1 or more IPv6
results and the AI_ALL hint is not provided.

http://pic.dhe.ibm.com/infocenter/zos/v1r11/index.jsp?topic=/com.ibm.zos.r11.bpxbd00/getaddrinfo.htm

"""
When the AF field has a value of AF_UNSPEC when the system supports IPv6 and
AI_ALL is set, the caller accepts IPv6 addresses and either IPv4 (if
AI_V4MAPPED is not set) or IPv4-mapped IPv6 (if AI_V4MAPPED is set) addresses.
"""

The specs are clear that we should get both sets of addresses without any
hints, and that AI_V4MAPPED is n/a to AF_UNSPEC _and_ that AI_ALL is n/a w/o
AI_V4MAPPED.   

But this is all long-standing z/os behavior that they won't break for
portability/compliance (we asked).

I was thinking of something like this in APR to make it look like every other
platform:

===================================================================
--- srclib/apr/network_io/unix/sockaddr.c       (revision 44260)
+++ srclib/apr/network_io/unix/sockaddr.c       (working copy)
@@ -325,6 +325,14 @@
         hints.ai_flags = AI_ADDRCONFIG;
     }
 #endif
+#ifdef __MVS__
+    /* z/OS will not return IPv4 address under AF_UNSPEC if any IPv6 results 
+     * are returned, unless AI_ALL is set.  
+     */
+    if (family == APR_UNSPEC) { 
+       hints.ai_flags |= AI_ALL        
+    }
+#endif
     if(hostname == NULL) {
 #ifdef AI_PASSIVE 
         /* If hostname is NULL, assume we are trying to bind to all

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


Mime
View raw message