diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 6ea3dd1f40..5285bacda6 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -3080,7 +3080,9 @@ nm_device_get_connectivity_state (NMDevice *self) priv = NM_DEVICE_GET_PRIVATE (self); - return NM_MAX (priv->concheck_x[0].state, priv->concheck_x[1].state); + return NM_MAX_WITH_CMP (nm_connectivity_state_cmp, + priv->concheck_x[0].state, + priv->concheck_x[1].state); } /*****************************************************************************/ 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;