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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]