diff options
author | Thomas Haller <thaller@redhat.com> | 2018-12-03 10:31:51 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-12-11 09:23:47 +0100 |
commit | ade753d06f4d8cac3a9c374fc1d9a409e2bce904 (patch) | |
tree | 537cfac71ea0f6f44f781da219eb0294dee96abc /src/nm-manager.c | |
parent | 487ee687d5bba82ee1054d74961afe122260811f (diff) | |
download | NetworkManager-ade753d06f4d8cac3a9c374fc1d9a409e2bce904.tar.gz |
connectivity: fix determining the global connectivity state
Since we determine the connectivity state of each device individually,
the global connectivity state is an aggregate of all these states.
I am not sure about considering here devices that don't have the (best)
default route for their respective address family. But anyway.
When we aggregate the best connectivity, we chose the numerical largest
value. That is wrong, because PORTAL is numerically smaller than
LIMITED.
That means, if you have two devices, one with connectivity LIMITED and
one with connectivity PORTAL, then LIMITED wrongly wins.
Fixes: 6b7e9f9b225e81d365fd95901a88a7bc59c1eb39
https://bugzilla.redhat.com/show_bug.cgi?id=1619873
Diffstat (limited to 'src/nm-manager.c')
-rw-r--r-- | src/nm-manager.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c index 8bd5a3acc0..11809de3d2 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -2855,18 +2855,21 @@ device_connectivity_changed (NMDevice *device, best_state = nm_device_get_connectivity_state (device); if (best_state < NM_CONNECTIVITY_FULL) { + /* FIXME: is this really correct, to considere devices that don't have + * (the best) default route for connectivity checking? */ c_list_for_each_entry (dev, &priv->devices_lst_head, devices_lst) { state = nm_device_get_connectivity_state (dev); - if (state <= best_state) + if (nm_connectivity_state_cmp (state, best_state) <= 0) continue; best_state = state; - if (best_state >= NM_CONNECTIVITY_FULL) { + if (nm_connectivity_state_cmp (best_state, NM_CONNECTIVITY_FULL) >= 0) { /* it doesn't get better than this. */ break; } } } nm_assert (best_state <= NM_CONNECTIVITY_FULL); + nm_assert (nm_connectivity_state_cmp (best_state, NM_CONNECTIVITY_FULL) <= 0); if (best_state != priv->connectivity_state) { priv->connectivity_state = best_state; |