]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
build: correctly check for SOICGIFVLAN GET_VLAN_VID_CMD command
authorLaine Stump <laine@laine.org>
Mon, 10 Feb 2014 14:08:26 +0000 (16:08 +0200)
committerLaine Stump <laine@laine.org>
Mon, 10 Feb 2014 23:43:38 +0000 (01:43 +0200)
In order to make a client-only build successful on RHEL4 (yes, you
read that correctly!), commit 3ed2e54 modified src/util/virnetdev.c so
that the functional version of virNetDevGetVLanID() was only compiled
if GET_VLAN_VID_CMD was defined. However, it is *never* defined, but
is only an enum value, so the proper version was no longer compiled
even on platforms that support it. This resulted in the vlan tag not
being properly set for guest traffic on VEPA mode guest macvtap
interfaces that were bound to a vlan interface (that's the only place
that libvirt currently uses virNetDevGetVLanID)

Since there is no way to compile conditionally based on the presence
of an enum value, this patch modifies configure.ac to check for said
enum value with AC_CHECK_DECLS(), which #defines
HAVE_DECL_GET_VLAN_VID_CMD to 1 if it's successful compiling a test
program that uses GET_VLAN_VID_CMD (and still #defines it, but to 0,
if it's not successful).  We can then make the compilation of
virNetDevGetVLanID() conditional on the value of
HAVE_DECL_GET_VLAN_VID_CMD.

configure.ac
src/util/virnetdev.c

index 7ecbee9ea04b868a5665f703d86249972feff66d..0d505d31b1401679696e76e39d2d28837d9881db 100644 (file)
@@ -2470,6 +2470,8 @@ if test "$with_virtualport" != "no"; then
 fi
 AM_CONDITIONAL([WITH_VIRTUALPORT], [test "$with_virtualport" = "yes"])
 
+dnl GET_VLAN_VID_CMD is required for virNetDevGetVLanID
+AC_CHECK_DECLS([GET_VLAN_VID_CMD], [], [], [[#include <linux/if_vlan.h>]])
 
 dnl netlink library
 
index e74fc5fccdf7f9c09890a0a0c3c792cb060714cc..6a1ee1ebbaafd812878afdb74b2693074dc674aa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2013 Red Hat, Inc.
+ * Copyright (C) 2007-2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -732,7 +732,7 @@ int virNetDevGetIndex(const char *ifname ATTRIBUTE_UNUSED,
 #endif /* ! SIOCGIFINDEX */
 
 
-#if defined(SIOCGIFVLAN) && defined(HAVE_STRUCT_IFREQ) && defined(GET_VLAN_VID_CMD)
+#if defined(SIOCGIFVLAN) && defined(HAVE_STRUCT_IFREQ) && HAVE_DECL_GET_VLAN_VID_CMD
 int virNetDevGetVLanID(const char *ifname, int *vlanid)
 {
     struct vlan_ioctl_args vlanargs = {