getaddrinfo in iOS 10 disregards AI_ADDRCONFIG hint, breaking IPv6 compatibility

Originator:randy
Number:rdar://28378416 Date Originated:9/19/2016
Status:Open Resolved:
Product:iOS Product Version:10.0.1
Classification:Serious Bug Reproducible:Always
 
Area:
Something not on this list

Summary:
Calling getaddrinfo with a hint of AI_ADDRCONFIG returns both IPv4 and IPv6 addresses when the only valid address on the system is an IPv6 address.  This causes IPv4 addresses to be vended which are non-reachable.

Steps to Reproduce:
- Enable NAT64/DNS64 shared internet connection on a hard wired Mac
- Connect to this access point with a device running iOS 10
- Call getaddrinfo passing hints of at least AI_ADDRCONFIG


Expected Results:
- Receive only results that represent routable addresses, in this case IPv6 only.

Actual Results:
- Receive results including IPv4 addresses

Version:
iOS 10.0.1 (14A403)

Notes:


Configuration:
iPhone 6S+

Comments

Just a quick note, we are seeing this in macOS Sierra 10.12 (16A319) as well, El Cap omitted the IPv4 results when running with no non-link local IPv4 addresses but Sierra returns them.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!