Closed Bug 1593693 Opened 6 years ago Closed 6 years ago

nsINetworkLinkService.isLinkUp returns true when no network connection is available

Categories

(Core :: Networking, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla72
Tracking Status
firefox72 --- verified

People

(Reporter: michal, Assigned: michal)

References

Details

(Whiteboard: [necko-triaged])

Attachments

(3 files)

Reported at https://github.com/mozilla-mobile/fenix/issues/6356

nsINetworkLinkService.isLinkUp is true when there is at least one link that's up and running, it's not a loopback device and has an address with a global scope. This works in most cases, but there are some Android versions which have a link that always matches this criteria regardless of the status of mobile or wifi network. We correctly detect that the network is unusable when we calculate network ID, because we cannot find a route to host defined by preference network.netlink.route.check.IPv4/6. But given that we want to have separate events for network change and network ID change, we probably don't want nsINetworkLinkService.isLinkUp to depend on network ID. We would easily end up sending network change events when nsINetworkLinkService.isLinkUp is false.

The two attached images show that status of rmnet1 is always the same regardless of the status of rmnet0 and wlan0 device.

Determining link status from states and addresses of the individual interfaces isn't always reliable. With this patch we assume the link is up when we could find a route for kRouteCheckIPv4 host or kRouteCheckIPv6 host.

I didn't find better way how to find out that devices like rmnet1 mentioned above are not really usable for outgoing traffic. So nsINetworkLinkService.isLinkUp now depends on the result of the route checking. Given that the checking is now needed for basic functionality, IP addresses used for route checking are now hardcoded because there is reason to allow to change them using preferences.

Whiteboard: [necko-triaged]
Pushed by mnovotny@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/755655b3175a nsINetworkLinkService.isLinkUp returns true when no network connection is available, r=valentin

I left an excessive comma in LOG statement when I changed the comment. It did compile successfully locally :-/

Flags: needinfo?(michal.novotny)
Pushed by mnovotny@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ca070ea1fc32 nsINetworkLinkService.isLinkUp returns true when no network connection is available, r=valentin
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72

Hi, verified as fixed on app build Firefox Preview Nightly 191120 (Build #13240608) and Gecko View 72.0a1-20191118093852 with Samsung Galaxy S9 (Android 8.0.0) and Google Pixel 3a (Android 9)
Scenarios checked:

-disable/enable wi-fi -> the "Link is up" data is updated correctly based on the state of the network
-have wi-fi enabled and restart device - the "Link is up" data is updated correctly based on the state of the network
-disable/enable mobile data - the "Link is up" data is updated correctly based on the state of the network
-have mobile data enabled and restart device - the "Link is up" data is updated correctly based on the state of the network
-have both Wi-fi and mobile data enabled and restart device - the "Link is up" data is updated correctly based on the state of the network

I will mark this ticket as verified-fixed.

Status: RESOLVED → VERIFIED
Regressions: 1600811
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: