Hi friends!

I'm in the process of adressing the network link status problem. To improve how Firefox deals with changed network conditions, like when you switch between wifi networks, captive portals, VPNs and more. The main bug for this is #939318.

I've attempted to write down the basic ideas of the planned updated behavior and I'm hosting it online for easy reading:

  http://daniel.haxx.se/firefox/networkstat.html

I'm also attaching the current markdown version snapshot of that document in case you prefer that.

If you have any improvements, feedback, questions or alternative suggestions just throw them at me here. I've started going down this path now, code-wise, and plan to start submitting some early patches soonish.

--

 / daniel.haxx.se
Objective
=========

Make Firefox respond to network changes better. Moving and switching between
wifi, cable network, VPN, captive portals, IPv6-only to IPv4-only and more is
known to not work satisfyingly. This document describes the design intended to
make such network changes get detected and dealt with accordingly and swiftly.


References
==========

Main bug covering this work from a Necko perspective: [#939318: 
NetworkLinkStatus respond to network 
changes](https://bugzilla.mozilla.org/show_bug.cgi?id=939318)

Valentin Tsatskin's summary of: [existing network/offline problems and 
bugs](https://people.mozilla.org/~vtsatskin/notes/Projects/Internet%20Connectivity/internet.connectivty),
 primarily from a UI/usage perspective.

[MDN: Online and offline 
events](https://developer.mozilla.org/en-US/docs/Online_and_offline_events)

Online Interface
================

An "online" interface is basically one with an IP address and possibly a few
other properties that makes it appear to be a functional network interface,
one that can be used to do TCP oriented work with to other machines.

Since most systems can have multiple network interfaces, the network interface
state is considered "online" if at least one interface matches the decription
above.

Work Offline
============

The traditional "Work Offline" mode that is available in the UI and through
API:s etc can still exist and work, and I want to get that functionality
merged into this description eventually.

Network Status
==============

Detect changes to network interfaces and send events. This means system
specific implementations.

This should and can be made completely automatically. There's no reason for a
user to even know about this going on. A prefs switch can be used for
enabling/disabling trial runs.

* When no "online" interface is around, this means we're offline. Unless we
  already were offline, send a network change: DOWN

  Set ifstate = down

* When there's is one or more interfaces deemed "online".

  Set ifstate = up

  Store the IP address + identifier for each "online" interface into a
  "checksum" and compare with the checksum of the previous network-change
  event.

  If this was a ifstate transition down => up

  - send event: UP

  - If it isn't a checksum match, then we have a new network topology: CHANGED
    (that is potentially a second event)

  If this was an up=>up (no ifstate transition)

  - If there's a perfect match (the same set of identical interfaces that 
    are online), then send no event

  - If it isn't a match, then we have a new network topology: CHANGED

Events
======

 - ifstate will be sent as a "network:link-status-changed" event.

   This event can now get a 'CHANGED' status, previously it could get only UP,
   DOWN and UNKNOWN.

 - "profile-change-net-teardown" is documented to mean "The network connection
   is going offline at this point". Should it set work offline mode? I'll start 
out
   having it so.


Event Listeners
===============

 - Captive Portal Detector (new)

   [#878566: Design Captive Portal Login 
UI](https://bugzilla.mozilla.org/show_bug.cgi?id=878566)

   [#562917: implement captive portal 
detection](https://bugzilla.mozilla.org/show_bug.cgi?id=562917)

   CHANGED: check for captive portal

 - nsIOService (only acts "network.manage-offline-status" is set *TRUE*)

   UP: set "Work offline mode" OFF

   DOWN: set "Work offline mode" ON +
         Autodial for Windows XP gets performed

 - DNS

   UP: do nothing (let the cache as exists remain)

   DOWN: do nothing (do we want to allow local name resolves in offline mode?
                     Bug 339814)

   CHANGED: flush cache

 - Sockets

   UP: do nothing

   DOWN: set activity timers to LOW

   CHANGED: set activity timers to LOW

 - auth cache (that sends auth automatically in plain text headers to hosts)

   CHANGED: flush

 - happy eyeballs decisions:

   CHANGED: flush
_______________________________________________
dev-tech-network mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-network

Reply via email to