]> xenbits.xensource.com Git - libvirt.git/commitdiff
interface_backend_udev: Implement link speed & state
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 5 Jun 2014 14:39:18 +0000 (16:39 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 11 Jun 2014 07:57:45 +0000 (09:57 +0200)
In the previous commit the helper function was prepared, so now
we can wire it up and benefit from it. The Makefile change is
required because we're including virnedev,h which includes
virnetlink.h which tries to include netlink/msg.h. However this
file is not under /usr/include directly but is dependent on libnl
used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/Makefile.am
src/interface/interface_backend_udev.c

index 30df68f7944af5796a6c2918cdba96ce0c5ef20e..9ab7c24afb7d6e3ed823bf46fda6662898122a09 100644 (file)
@@ -1400,7 +1400,7 @@ endif ! WITH_DRIVER_MODULES
 libvirt_driver_interface_la_CFLAGS = \
                -I$(top_srcdir)/src/access \
                -I$(top_srcdir)/src/conf \
-               $(AM_CFLAGS)
+               $(AM_CFLAGS) $(LIBNL_CFLAGS)
 libvirt_driver_interface_la_LDFLAGS = $(AM_LDFLAGS)
 libvirt_driver_interface_la_LIBADD =
 if WITH_NETCF
index c5353ea2cf7deab55c88b80b6a9334450a14a11c..ecb1b2a35fcb98381d3360c715344aa970d6414c 100644 (file)
@@ -34,6 +34,7 @@
 #include "viralloc.h"
 #include "virstring.h"
 #include "viraccessapicheck.h"
+#include "virnetdev.h"
 
 #define VIR_FROM_THIS VIR_FROM_INTERFACE
 
@@ -1059,6 +1060,10 @@ udevGetIfaceDef(struct udev *udev, const char *name)
                    udev_device_get_sysattr_value(dev, "address")) < 0)
         goto error;
 
+    /* Link state and speed */
+    if (virNetDevGetLinkInfo(ifacedef->name, &ifacedef->lnk) < 0)
+        goto error;
+
     /* MTU */
     mtu_str = udev_device_get_sysattr_value(dev, "mtu");
     if (virStrToLong_ui(mtu_str, NULL, 10, &mtu) < 0) {