Reachability icon indicating copy to clipboard operation
Reachability copied to clipboard

Supporting IPv6 in iOS 9

Open shmhth opened this issue 10 years ago • 4 comments

The other day, Apple announced the following.

Supporting IPv6 in iOS 9 https://developer.apple.com/news/?id=08282015a

Supporting IPv6 DNS64/NAT64 Networks https://developer.apple.com/library/prerelease/ios/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/UnderstandingandPreparingfortheIPv6Transition/UnderstandingandPreparingfortheIPv6Transition.html#//apple_ref/doc/uid/TP40010220-CH213-SW1

At least I found "struct sockaddr_in", "AF_INET" in Reachability. Pardon my ignorance, but is it safe to continue to use these?

shmhth avatar Sep 15 '15 06:09 shmhth

mark

afanti100 avatar May 06 '16 06:05 afanti100

It might not work as it is on IP6 Only networks. I think, code should be using sockaddr_in6 for that. See for example, Alamofire Network Reachability Manager: https://github.com/Alamofire/Alamofire/blob/master/Source/NetworkReachabilityManager.swift#L125

paulz avatar May 06 '16 17:05 paulz

Just a quick heads-up: Apple has started rejecting apps that do not support IPv6. Maybe this should be a higher priority?

leolobato avatar Aug 19 '16 07:08 leolobato

Reachability as it is should work fine with IPv6:

  • +reachabilityForInternetConnection uses a special address of 0.0.0.0. The API handles this already for IPv6, as stated by Apple here.
  • +reachabilityForLocalWiFi has been removed from Apple's reachability because it is now largely obsolete in its usefulness. That said, it uses a local link IP (169.254.0.0) which should work regardless of whether the user is using an IPv6 network since that IP does not connect to outside the device. An Apple employee also concluded this here. This is something I haven't tested however.
  • +reachabilityWithAddress: already supports both IPv4 and IPv6 - it is up to whoever is calling the method to ensure that you are passing in a sockaddr_in6 where appropriate.

From what I've seen, Apple is rejecting apps by testing if they work under an IPv6 network rather than blindly checking APIs. If you are getting rejections, I guess you could try removing +reachabilityForLocalWiFi as then it would match exactly what Apple's sample code is doing but I don't think that's necessary.

Bo98 avatar Aug 19 '16 22:08 Bo98