about summary refs log tree commit diff
path: root/src/nm-manager.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2019-02-26 19:02:28 +0100
committerMichael Biebl <biebl@debian.org>2019-02-26 19:02:28 +0100
commit439c9d76f576ae28c73571d444c59d9e95e5ad11 (patch)
tree7591e0b43641131fc049d6d7a0bd19e9e4964a40 /src/nm-manager.c
parent12aead6b161a3312673ac62686af0350061c0666 (diff)
parent964ae8cc391520440cf5aa13e2b9cc34850ea6c2 (diff)
Update upstream source from tag 'upstream/1.14.6'
Update to upstream version '1.14.6'
with Debian dir ef09251bb8b7a4afa8e2b004d785517d8a2d973d
Diffstat (limited to 'src/nm-manager.c')
-rw-r--r--src/nm-manager.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 7598995d..3ddc3b92 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -1596,7 +1596,12 @@ again:
 static gboolean
 device_is_wake_on_lan (NMPlatform *platform, NMDevice *device)
 {
-	return nm_platform_link_get_wake_on_lan (platform, nm_device_get_ip_ifindex (device));
+	int ifindex;
+
+	ifindex = nm_device_get_ip_ifindex (device);
+	if (ifindex <= 0)
+		return FALSE;
+	return nm_platform_link_get_wake_on_lan (platform, ifindex);
 }
 
 static void
@@ -2816,18 +2821,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;