summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-04-11 12:04:56 +0200
committerThomas Haller <thaller@redhat.com>2018-04-11 12:06:36 +0200
commitd0cee07a0f1bc788cb117446cedd9157a572d961 (patch)
tree30aa7c7c56886629925a739b1b0e8b270f68084f
parentf48b4af85035cbd9e539fc00e8432c2fece1c53d (diff)
downloadNetworkManager-th/fix-fake-connectivity-state.tar.gz
connectivity: fix the device's fake connectivity stateth/fix-fake-connectivity-state
Otherwise, if connectivity checking was disabled, we would never reset the connectivity state and leave it wrongly at UNKNOWN. nm_device_check_connectivity_update_interval() is already called during state-changes, so this is the right place. However, it's far from perfect still, because we might not notice when a default-route gets added or removed. Also, devices that are not in ACTIVATED state, are considered with connectivity NONE. Which might not be correct. Fixes: 0a62a0e9039e49e05dae6af9a96c381629bccd58
-rw-r--r--src/devices/nm-device.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 55667ffd78..9b9584ce71 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -632,6 +632,8 @@ static void _set_mtu (NMDevice *self, guint32 mtu);
static void _commit_mtu (NMDevice *self, const NMIP4Config *config);
static void _cancel_activation (NMDevice *self);
+static void concheck_update_state (NMDevice *self, NMConnectivityState state, gboolean is_periodic);
+
/*****************************************************************************/
NM_UTILS_LOOKUP_STR_DEFINE_STATIC (queued_state_to_string, NMDeviceState,
@@ -2390,6 +2392,9 @@ nm_device_check_connectivity_update_interval (NMDevice *self)
if (!new_interval) {
/* this will cancel any potentially pending timeout. */
concheck_periodic_schedule_do (self, 0);
+
+ /* also update the fake connectivity state. */
+ concheck_update_state (self, NM_CONNECTIVITY_FAKE, TRUE);
return;
}
@@ -2419,6 +2424,10 @@ concheck_update_state (NMDevice *self, NMConnectivityState state, gboolean is_pe
/* If the connectivity check is disabled and we obtain a fake
* result, make an optimistic guess. */
if (priv->state == NM_DEVICE_STATE_ACTIVATED) {
+ /* FIXME: the fake connectivity state depends on the availablility of
+ * a default route. However, we have no mechanism that rechecks the
+ * value if a device route appears/disappears after the device
+ * was activated. */
if (nm_device_get_best_default_route (self, AF_UNSPEC))
state = NM_CONNECTIVITY_FULL;
else