Skip to content

Support IPv4/6 on iOS #146

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

Merged
merged 2 commits into from
Jul 19, 2019
Merged

Support IPv4/6 on iOS #146

merged 2 commits into from
Jul 19, 2019

Conversation

enahum
Copy link
Contributor

@enahum enahum commented Jul 18, 2019

Overview

Summary

At Mattermost we received a lot of reports about Internet Reachability not working on LTE networks that assign IPv6 addresses, the current implementation uses a hostname based to test for reachability and the hostname "apple.com" does not have IPv6 addresses causing the check to fail.

With this PR we implemented the Internet connectivity test exposed in this example

it uses a different mechanism.

- reachabilityWithHostName and SCNetworkReachabilityCreateWithName:  Internally, this API works be resolving the host name to a set of IP addresses (this can be any combination of IPv4 and IPv6 addresses) and establishing separate monitors on all available addresses.

☝️ for some reason it seems that is does not work great with IPv6 as the hostname does not have IPv6 addresses assigned


With the changes made we are now using this:

- 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.

Test Plan

The changes in code only affect iOS and there should not be any changes in behavior other than detecting internet connectivity on IPv6 networks

Copy link
Collaborator

@matt-oakes matt-oakes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great at a code level, but I want to check that everything still works on an actual device before releasing. I will do that as soon as I can.

Thanks!

@enahum
Copy link
Contributor Author

enahum commented Jul 18, 2019

Sure @matt-oakes no rush, let me know if you need anything from my end

@matt-oakes matt-oakes merged commit f4e3378 into react-native-netinfo:master Jul 19, 2019
react-native-community-bot pushed a commit that referenced this pull request Jul 19, 2019
## [4.1.2](v4.1.1...v4.1.2) (2019-07-19)

### Bug Fixes

* **iOS:** Ensure IPv6 networks work correctly ([#146](#146) by [@enahum](https://github.com/enahum)) ([f4e3378](f4e3378))
@react-native-community-bot
Copy link
Collaborator

🎉 This PR is included in version 4.1.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants