manager: retrigger the connectivity check if we loose a default route

Update the connectivity state if we go from CONNECTED_GLOBAL to
CONNECTED_LOCAL. It will likely fail immediately (unless there's a default
route we're not aware of or the check URL is routable locally), keeping the
Connectivity property up-to-date.
This commit is contained in:
Lubomir Rintel
2017-02-16 10:07:10 +01:00
parent 5caa9d877b
commit 07bf4151ba

View File

@@ -854,7 +854,20 @@ nm_manager_update_state (NMManager *manager)
nm_connectivity_set_online (priv->connectivity, new_state >= NM_STATE_CONNECTED_LOCAL);
if (new_state == NM_STATE_CONNECTED_SITE || force_connectivity_check) {
if (new_state == NM_STATE_CONNECTED_SITE) {
/* We have a default route, let's see if we can reach the Internet or a
* captive portal. */
force_connectivity_check = TRUE;
}
if (new_state == NM_STATE_CONNECTED_LOCAL) {
/* If we just lost a default route, let's retrigger the connectivity check
* so that the connectivity property would be updated to indicate we can't
* reach the Internet anymore. */
force_connectivity_check = TRUE;
}
if (force_connectivity_check) {
nm_connectivity_check_async (priv->connectivity,
checked_connectivity,
g_object_ref (manager));