[libvirt] [PATCH] nodedev: udev: Fix handling of wireless NIC

Cole Robinson crobinso at redhat.com
Wed May 26 19:55:44 UTC 2010


Wireless NICs were being ignored because we weren't correctly handling
device type. Fix this, as well as wireless NIC net subtype.

Signed-off-by: Cole Robinson <crobinso at redhat.com>
---
 src/node_device/node_device_udev.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index f0485f1..4915d4e 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -597,8 +597,16 @@ static int udevProcessNetworkInterface(struct udev_device *device,
                                        virNodeDeviceDefPtr def)
 {
     int ret = -1;
+    const char *devtype = NULL;
     union _virNodeDevCapData *data = &def->caps->data;
 
+    devtype = udev_device_get_devtype(device);
+    if (devtype && STREQ(devtype, "wlan")) {
+        data->net.subtype = VIR_NODE_DEV_CAP_NET_80211;
+    } else {
+        data->net.subtype = VIR_NODE_DEV_CAP_NET_80203;
+    }
+
     if (udevGetStringProperty(device,
                               "INTERFACE",
                               &data->net.ifname) == PROPERTY_ERROR) {
@@ -1074,6 +1082,8 @@ static int udevGetDeviceType(struct udev_device *device,
     int ret = 0;
 
     devtype = udev_device_get_devtype(device);
+    VIR_DEBUG("Found device type '%s' for device '%s'",
+              devtype, udev_device_get_sysname(device));
 
     if (devtype != NULL && STREQ(devtype, "usb_device")) {
         *type = VIR_NODE_DEV_CAP_USB_DEV;
@@ -1112,7 +1122,7 @@ static int udevGetDeviceType(struct udev_device *device,
 
     /* It does not appear that network interfaces set the device type
      * property. */
-    if (devtype == NULL &&
+    if ((devtype == NULL || STREQ(devtype, "wlan")) &&
         udevGetStringProperty(device,
                               "INTERFACE",
                               &tmp_string) == PROPERTY_FOUND) {
-- 
1.6.6.1




More information about the libvir-list mailing list