connectivity: schedule connectivity timers per-device and probe for short outages

System Internals / NetworkManager - Thomas Haller [redhat.com] - 10 April 2018 13:11 EDT

It might happen, that connectivitiy is lost only for a moment and returns soon after. Based on that assumption, when we loose connectivity we want to have a probe interval where we check for returning connectivity more frequently.

For that, we handle tracking of the timeouts per-device.

The intervall shall start with 1 seconds, and double the interval time until the full interval is reached. Actually, due to the implementation, it's unlikely that we already perform the second check 1 second later. That is because commonly the first check returns before the one second timeout is reached and bumps the interval to 2 seconds right away.

Also, we go through extra lengths so that manual connectivity check delay the periodic checks. By being more smart about that, we can reduce the number of connectivity checks, but still keeping the promise to check at least within the requested interval.

The complexity of book keeping the timeouts is remarkable. But I think it is worth the effort and we should try hard to

- have a connectivity state as accurate as possible. Clearly, connectivity checking means that we probing, so being more intelligent about timeout and backoff timers can result in a better connectivity state. The connectivity state is important because we use it for the default-route penaly and the GUI indicates bad connectivity.

- be intelligent about avoiding redundant connectivity checks. While we want to check often to get an accurate connectivity state, we also want to minimize the number of HTTP requests, in case the connectivity is established and suppossedly stable.

Also, perform connectivity checks in every state of the device. Even if a device is disconnected, it still might have connectivity, for example if the user externally adds an IP address on an unmanaged device.

https://bugzilla.gnome.org/show_bug.cgi?id=792240

0a62a0e90 connectivity: schedule connectivity timers per-device and probe for short outages
src/devices/nm-device.c | 344 +++++++++++++++++++++++++++++++++++++++++-------
src/devices/nm-device.h | 2 +
src/main.c | 2 -
src/nm-connectivity.c | 33 ++---
src/nm-connectivity.h | 4 +-
src/nm-manager.c | 51 +++++--
6 files changed, 354 insertions(+), 82 deletions(-)

Upstream: cgit.freedesktop.org


  • Share