[PATCH] virnetdev: fix build with old kernel

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

 



Commit c9027d8f added a detection of NIC HW features, but some of them
are not available in old kernel.  Very old kernels lack enum
ethtool_flags and even if this enum is present, not all values are
available for all kernels.  To be sure that we have everything in kernel
that we need, we must check for existence of newest value which is
ETH_FLAG_TXVLAN.  Only then we can be sure that the feature detection
can be successfully built.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 configure.ac         | 6 ++++++
 src/util/virnetdev.c | 6 ++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index e071813..3cffb84 100644
--- a/configure.ac
+++ b/configure.ac
@@ -383,6 +383,12 @@ AC_CHECK_TYPE([struct ifreq],
         #include <net/if.h>
   ]])
 
+AC_CHECK_DECL([ETH_FLAG_TXVLAN],
+  [AC_DEFINE([HAVE_ETH_FLAG_TXVLAN],[1],
+    [Defined if ETH_FLAG_TXVLAN exists in linux/ethtool.h])],
+  [], [[#include <linux/ethtool.h>
+  ]])
+
 dnl Our only use of libtasn1.h is in the testsuite, and can be skipped
 dnl if the header is not present.  Assume -ltasn1 is present if the
 dnl header could be found.
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 971db43..7519579 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -47,7 +47,8 @@
 # undef HAVE_STRUCT_IFREQ
 #endif
 
-#if defined(SIOCETHTOOL) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCETHTOOL) && defined(HAVE_STRUCT_IFREQ) && \
+    defined(HAVE_ETH_FLAG_TXVLAN)
 # include <linux/ethtool.h>
 #endif
 
@@ -2733,7 +2734,8 @@ int virNetDevGetRxFilter(const char *ifname,
     return ret;
 }
 
-#if defined(SIOCETHTOOL) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCETHTOOL) && defined(HAVE_STRUCT_IFREQ) && \
+    defined(HAVE_ETH_FLAG_TXVLAN)
 
 /**
  * virNetDevFeatureAvailable
-- 
2.0.5

--
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]