[libvirt] [PATCH] Fix compilation on non-macvtap systems

Matthias Bolte matthias.bolte at googlemail.com
Wed Jun 22 22:42:57 UTC 2011


The refactoring in 6a5978833a5 and df3d8c362d3 was incomplete
as it accidentally moved macvtap related code out of a
#if WITH_MACVTAP in a #if __linux__ block. To fix this move
ifaceMacvtapLinkAdd and ifaceMacvtapLinkDump back under
#if WITH_MACVTAP.

Also nlComm was moved from #if WITH_MACVTAP to #if __linux__
but configure.ac was not updated to match this, as libnl is
now required on Linux always because of this.

Also related to libnl, libvirt_lxc missed LIBNL_CFLAGS in it's
CFLAGS.
---
 configure.ac         |    6 +++---
 src/Makefile.am      |    1 +
 src/util/interface.c |    6 +++---
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index f816696..4c81e3b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2372,10 +2372,10 @@ dnl netlink library
 LIBNL_CFLAGS=""
 LIBNL_LIBS=""
 
-if test "$with_macvtap" = "yes"; then
+if test "$with_linux" = "yes"; then
     PKG_CHECK_MODULES([LIBNL], [libnl-1 >= $LIBNL_REQUIRED], [
     ], [
-        AC_MSG_ERROR([libnl-devel >= $LIBNL_REQUIRED is required for macvtap support])
+        AC_MSG_ERROR([libnl-devel >= $LIBNL_REQUIRED is required])
     ])
 fi
 
@@ -2574,7 +2574,7 @@ AC_MSG_NOTICE([    pcap: $LIBPCAP_CFLAGS $LIBPCAP_LIBS])
 else
 AC_MSG_NOTICE([    pcap: no])
 fi
-if test "$with_macvtap" = "yes" ; then
+if test "$with_linux" = "yes" ; then
 AC_MSG_NOTICE([      nl: $LIBNL_CFLAGS $LIBNL_LIBS])
 else
 AC_MSG_NOTICE([      nl: no])
diff --git a/src/Makefile.am b/src/Makefile.am
index b292f9f..9e69f37 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1243,6 +1243,7 @@ libvirt_lxc_CFLAGS =				\
 		$(CAPNG_CFLAGS)			\
 		$(YAJL_CFLAGS)			\
 		$(AUDIT_CFLAGS)			\
+		$(LIBNL_CFLAGS)			\
 		-I at top_srcdir@/src/conf		\
 		$(AM_CFLAGS)
 endif
diff --git a/src/util/interface.c b/src/util/interface.c
index 02544d9..03f9367 100644
--- a/src/util/interface.c
+++ b/src/util/interface.c
@@ -494,7 +494,7 @@ ifaceSetMacaddr(const char *ifname ATTRIBUTE_UNUSED,
 
 
 /**
- * ifaceLinkAdd
+ * ifaceMacvtapLinkAdd
  *
  * @type: The type of device, i.e., "macvtap"
  * @macaddress: The MAC address of the device
@@ -510,7 +510,7 @@ ifaceSetMacaddr(const char *ifname ATTRIBUTE_UNUSED,
  *
  * Returns 0 on success, -1 on fatal error.
  */
-#if __linux__
+#if WITH_MACVTAP
 int
 ifaceMacvtapLinkAdd(const char *type,
                     const unsigned char *macaddress, int macaddrsize,
@@ -758,7 +758,7 @@ ifaceLinkDel(const char *ifname ATTRIBUTE_UNUSED)
 #endif
 
 
-#if __linux__
+#if WITH_MACVTAP
 static struct nla_policy ifla_policy[IFLA_MAX + 1] =
 {
   [IFLA_VF_PORTS] = { .type = NLA_NESTED },
-- 
1.7.0.4




More information about the libvir-list mailing list