summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2010-11-23 13:10:01 -0600
committerDan Williams <dcbw@redhat.com>2010-11-23 13:11:44 -0600
commit608783c5b773a30139158ef3b00c211dcc255ee8 (patch)
tree6e54d8ff04fc9c357d1e5d143ad643a6f7476d93
parent4b022ed32bb3d729fd21d2e33483fda03c6a6333 (diff)
core: handle device removal when properties are unreadable
By the time we get the udev device removal notification we may not be able to read properties, since the device has already been removed from sysfs. That means we can't get the ifindex, so we need to fall back to the interface name. But we always want to prefer the ifindex since that will never change as long as the device is connected, unlike the interface name.
-rw-r--r--src/nm-manager.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c
index eb393facc..48f2173d8 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -2426,6 +2426,14 @@ udev_device_removed_cb (NMUdevManager *manager,
ifindex = g_udev_device_get_property_as_int (udev_device, "IFINDEX");
device = find_device_by_ifindex (self, ifindex);
+ if (!device) {
+ /* On removal we won't always be able to read properties anymore, as
+ * they may have already been removed from sysfs. Instead, we just
+ * have to fall back to the device's interface name.
+ */
+ device = find_device_by_iface (self, g_udev_device_get_name (udev_device));
+ }
+
if (device)
priv->devices = remove_one_device (self, priv->devices, device, FALSE);
}