about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2011-03-11 14:22:35 +0100
committerMichael Biebl <biebl@debian.org>2011-03-11 14:33:42 +0100
commitf16428cbba9e2e2ec476bfdcd6657429666919ea (patch)
tree3f744f0ddf8e7b1502ff6ff88799d3a408eaeb3f
parent44eff6984a48b7ef12115ab6f06c1199f969efcc (diff)
Correctly handle device removal events when properties are unreadable
* debian/patches/82-core-handle-device-removal.patch
  - Cherry-pick patch from upstream to correctly handle device removal
    when properties are unreadable. (Closes: #605570)
-rw-r--r--debian/changelog8
-rw-r--r--debian/patches/82-core-handle-device-removal.patch37
-rw-r--r--debian/patches/series1
3 files changed, 46 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 46daaec4..bb3d8a3b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+network-manager (0.8.1-6+squeeze1) UNRELEASED; urgency=low
+
+  * debian/patches/82-core-handle-device-removal.patch
+    - Cherry-pick patch from upstream to correctly handle device removal when
+      properties are unreadable. (Closes: #605570)
+
+ -- Michael Biebl <biebl@debian.org>  Sat, 22 Jan 2011 16:53:48 +0100
+
 network-manager (0.8.1-6) unstable; urgency=low
 
   * debian/patches/40-umanaged-interfaces.patch
diff --git a/debian/patches/82-core-handle-device-removal.patch b/debian/patches/82-core-handle-device-removal.patch
new file mode 100644
index 00000000..deac3a69
--- /dev/null
+++ b/debian/patches/82-core-handle-device-removal.patch
@@ -0,0 +1,37 @@
+From aff8f48190458c7dc894ad0ec07c935dc530abab Mon Sep 17 00:00:00 2001
+From: Dan Williams <dcbw@redhat.com>
+Date: Tue, 23 Nov 2010 13:10:01 -0600
+Subject: [PATCH] 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.
+---
+ src/nm-manager.c |    8 ++++++++
+ 1 files changed, 8 insertions(+), 0 deletions(-)
+
+diff --git a/src/nm-manager.c b/src/nm-manager.c
+index eb393fa..48f2173 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);
+ }
+-- 
+1.7.2.3
+
diff --git a/debian/patches/series b/debian/patches/series
index 012269a9..43302803 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,4 @@
 30-typo_fix.patch
 40-umanaged-interfaces.patch
 50-bridge-interfaces.patch
+82-core-handle-device-removal.patch