New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why AFNetworkReachabilityManager support IPv6 need to do conditional compile? #3498

Open
wtlucky opened this Issue May 9, 2016 · 15 comments

Comments

Projects
None yet
10 participants
@wtlucky

wtlucky commented May 9, 2016

I don't understand why there needs to check the OS_VERSION_MIN_REQUIRED. This mean only the iOS version over 9.0 and OSX version over 10.11 supported IPv6. Is this right? #3174

+ (instancetype)manager
{
#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
    struct sockaddr_in6 address;
    bzero(&address, sizeof(address));
    address.sin6_len = sizeof(address);
    address.sin6_family = AF_INET6;
#else
    struct sockaddr_in address;
    bzero(&address, sizeof(address));
    address.sin_len = sizeof(address);
    address.sin_family = AF_INET;
#endif
    return [self managerForAddress:&address];
}
@kcharwood

This comment has been minimized.

Show comment
Hide comment
@kcharwood

kcharwood May 10, 2016

Contributor

Take a look at this issue: Alamofire/Alamofire#1228.

We need to make sure we are consistent in both places.

Contributor

kcharwood commented May 10, 2016

Take a look at this issue: Alamofire/Alamofire#1228.

We need to make sure we are consistent in both places.

@taylesworth

This comment has been minimized.

Show comment
Hide comment
@taylesworth

taylesworth May 10, 2016

Except AlamoFire uses a run-time check rather than a compile-time check, right?

taylesworth commented May 10, 2016

Except AlamoFire uses a run-time check rather than a compile-time check, right?

@kcharwood

This comment has been minimized.

Show comment
Hide comment
@kcharwood

kcharwood May 10, 2016

Contributor

Yes, that rights, mainly due to some bugs with how iOS 8 works with IPv6

Contributor

kcharwood commented May 10, 2016

Yes, that rights, mainly due to some bugs with how iOS 8 works with IPv6

@wtlucky

This comment has been minimized.

Show comment
Hide comment
@wtlucky

wtlucky May 10, 2016

Yes,I have found this bug both iOS 7 and iOS 8 works with IPv6. But why not use run-time check there? If I use the iOS 9 SDK compile the project and running it on iOS 7, the bug still exist.

wtlucky commented May 10, 2016

Yes,I have found this bug both iOS 7 and iOS 8 works with IPv6. But why not use run-time check there? If I use the iOS 9 SDK compile the project and running it on iOS 7, the bug still exist.

@kcharwood

This comment has been minimized.

Show comment
Hide comment
@kcharwood

kcharwood May 10, 2016

Contributor

Right. I'm agreeing with you. We should probably migrate to a runtime check.

Contributor

kcharwood commented May 10, 2016

Right. I'm agreeing with you. We should probably migrate to a runtime check.

@hei9gag

This comment has been minimized.

Show comment
Hide comment
@hei9gag

hei9gag May 11, 2016

I am using iOS 9 and connect to a NAT64 network hotspot share from my Mac. I try to test the AFNetworking Reachability without ipv6 setting and it still works. Can someone explain? Many thanks.

hei9gag commented May 11, 2016

I am using iOS 9 and connect to a NAT64 network hotspot share from my Mac. I try to test the AFNetworking Reachability without ipv6 setting and it still works. Can someone explain? Many thanks.

@cezheng

This comment has been minimized.

Show comment
Hide comment
@cezheng

cezheng May 16, 2016

However in the README of the Reachability sample, it says

Reachability fully supports IPv6. More specifically, each of the APIs handles IPv6 in the following way:

...

reachabilityForInternetConnection: This monitors the address 0.0.0.0, which reachability treats as a special token that causes it to actually monitor the general routing status of the device, both IPv4 and IPv6.


So what is the actual reason to use sockaddr_in6 on iOS 9 or later? I just worry that it will cause problems when connected to a IPv4-only network

cezheng commented May 16, 2016

However in the README of the Reachability sample, it says

Reachability fully supports IPv6. More specifically, each of the APIs handles IPv6 in the following way:

...

reachabilityForInternetConnection: This monitors the address 0.0.0.0, which reachability treats as a special token that causes it to actually monitor the general routing status of the device, both IPv4 and IPv6.


So what is the actual reason to use sockaddr_in6 on iOS 9 or later? I just worry that it will cause problems when connected to a IPv4-only network

@hei9gag

This comment has been minimized.

Show comment
Hide comment
@hei9gag

hei9gag May 18, 2016

It seems the Reachability function is not compatible to iOS 7. The function returns no reachable status even I have connected to a NAT64 share network. Is this a bug or iOS 7 isn't support NAT64?

Also I found that reachabilityDidChange is slightly delay to trigger in iOS 8 (compare to iOS 9) when I try to connect to a IPv6 network from no network status.

hei9gag commented May 18, 2016

It seems the Reachability function is not compatible to iOS 7. The function returns no reachable status even I have connected to a NAT64 share network. Is this a bug or iOS 7 isn't support NAT64?

Also I found that reachabilityDidChange is slightly delay to trigger in iOS 8 (compare to iOS 9) when I try to connect to a IPv6 network from no network status.

@dustturtle

This comment has been minimized.

Show comment
Hide comment
@dustturtle

dustturtle May 19, 2016

I agree with cezheng. Demo by apple maybe right. I will just use the sockaddr_in in my app. @cezheng

dustturtle commented May 19, 2016

I agree with cezheng. Demo by apple maybe right. I will just use the sockaddr_in in my app. @cezheng

@limXInfi

This comment has been minimized.

Show comment
Hide comment
@limXInfi

limXInfi May 20, 2016

There is no need to change anything if you just want to check whether the internet is avaliable,just like the Sample by Apple:
reachabilityForInternetConnection //This monitors the address 0.0.0.0, which reachability treats as a special token that causes it to actually monitor the general routing status of the device, both IPv4 and IPv6 is it right?

limXInfi commented May 20, 2016

There is no need to change anything if you just want to check whether the internet is avaliable,just like the Sample by Apple:
reachabilityForInternetConnection //This monitors the address 0.0.0.0, which reachability treats as a special token that causes it to actually monitor the general routing status of the device, both IPv4 and IPv6 is it right?

@cezheng

This comment has been minimized.

Show comment
Hide comment
@cezheng

cezheng May 22, 2016

@kcharwood Shall we draw to a conclusion yet? I think we should remove the sockaddr_in6 part of the code.

cezheng commented May 22, 2016

@kcharwood Shall we draw to a conclusion yet? I think we should remove the sockaddr_in6 part of the code.

@dustturtle

This comment has been minimized.

Show comment
Hide comment
@dustturtle

dustturtle May 23, 2016

But I think the solution used here is also correct. We can use ipv4/ipv6 either under iOS9 in this condition.

dustturtle commented May 23, 2016

But I think the solution used here is also correct. We can use ipv4/ipv6 either under iOS9 in this condition.

@AdrianaPineda

This comment has been minimized.

Show comment
Hide comment
@AdrianaPineda

AdrianaPineda Jun 20, 2016

@kcharwood do you have any updates on this? Should the os version check be removed as Alamofire?

AdrianaPineda commented Jun 20, 2016

@kcharwood do you have any updates on this? Should the os version check be removed as Alamofire?

@xx-li

This comment has been minimized.

Show comment
Hide comment
@xx-li

xx-li Dec 16, 2016

My app minimum supported version of the app is iOS9, use AFNetworking by cocoapods, when run at any device, __IPHONE_OS_VERSION_MIN_REQUIRED is the the pod targert minimum version, value is 70000, Causing works with IPv4 all the time。

xx-li commented Dec 16, 2016

My app minimum supported version of the app is iOS9, use AFNetworking by cocoapods, when run at any device, __IPHONE_OS_VERSION_MIN_REQUIRED is the the pod targert minimum version, value is 70000, Causing works with IPv4 all the time。

@shumintao

This comment has been minimized.

Show comment
Hide comment
@shumintao

shumintao May 24, 2017

can you tell me how to use AlamoFire for swift in IVP6

shumintao commented May 24, 2017

can you tell me how to use AlamoFire for swift in IVP6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment