Blame SOURCES/libvirt-build-correctly-check-for-SOICGIFVLAN-GET_VLAN_VID_CMD-command.patch

c401cc
From e78b3cd278d8262498d396f61e81a57728ab022a Mon Sep 17 00:00:00 2001
c401cc
Message-Id: <e78b3cd278d8262498d396f61e81a57728ab022a@dist-git>
c401cc
From: Laine Stump <laine@laine.org>
c401cc
Date: Mon, 10 Feb 2014 16:57:19 -0700
c401cc
Subject: [PATCH] build: correctly check for SOICGIFVLAN GET_VLAN_VID_CMD
c401cc
 command
c401cc
c401cc
https://bugzilla.redhat.com/show_bug.cgi?id=1062665
c401cc
c401cc
In order to make a client-only build successful on RHEL4 (yes, you
c401cc
read that correctly!), commit 3ed2e54 modified src/util/virnetdev.c so
c401cc
that the functional version of virNetDevGetVLanID() was only compiled
c401cc
if GET_VLAN_VID_CMD was defined. However, it is *never* defined, but
c401cc
is only an enum value, so the proper version was no longer compiled
c401cc
even on platforms that support it. This resulted in the vlan tag not
c401cc
being properly set for guest traffic on VEPA mode guest macvtap
c401cc
interfaces that were bound to a vlan interface (that's the only place
c401cc
that libvirt currently uses virNetDevGetVLanID)
c401cc
c401cc
Since there is no way to compile conditionally based on the presence
c401cc
of an enum value, this patch modifies configure.ac to check for said
c401cc
enum value with AC_CHECK_DECLS(), which #defines
c401cc
HAVE_DECL_GET_VLAN_VID_CMD to 1 if it's successful compiling a test
c401cc
program that uses GET_VLAN_VID_CMD (and still #defines it, but to 0,
c401cc
if it's not successful).  We can then make the compilation of
c401cc
virNetDevGetVLanID() conditional on the value of
c401cc
HAVE_DECL_GET_VLAN_VID_CMD.
c401cc
c401cc
(cherry picked from commit 0144d72963813542f31150591442857c2c6ad47e)
c401cc
c401cc
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c401cc
---
c401cc
 configure.ac         | 2 ++
c401cc
 src/util/virnetdev.c | 4 ++--
c401cc
 2 files changed, 4 insertions(+), 2 deletions(-)
c401cc
c401cc
diff --git a/configure.ac b/configure.ac
c401cc
index 1fe901d..8f5f167 100644
c401cc
--- a/configure.ac
c401cc
+++ b/configure.ac
c401cc
@@ -2402,6 +2402,8 @@ if test "$with_virtualport" != "no"; then
c401cc
 fi
c401cc
 AM_CONDITIONAL([WITH_VIRTUALPORT], [test "$with_virtualport" = "yes"])
c401cc
 
c401cc
+dnl GET_VLAN_VID_CMD is required for virNetDevGetVLanID
c401cc
+AC_CHECK_DECLS([GET_VLAN_VID_CMD], [], [], [[#include <linux/if_vlan.h>]])
c401cc
 
c401cc
 dnl netlink library
c401cc
 
c401cc
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
c401cc
index 566a207..6d23a04 100644
c401cc
--- a/src/util/virnetdev.c
c401cc
+++ b/src/util/virnetdev.c
c401cc
@@ -1,5 +1,5 @@
c401cc
 /*
c401cc
- * Copyright (C) 2007-2013 Red Hat, Inc.
c401cc
+ * Copyright (C) 2007-2014 Red Hat, Inc.
c401cc
  *
c401cc
  * This library is free software; you can redistribute it and/or
c401cc
  * modify it under the terms of the GNU Lesser General Public
c401cc
@@ -732,7 +732,7 @@ int virNetDevGetIndex(const char *ifname ATTRIBUTE_UNUSED,
c401cc
 #endif /* ! SIOCGIFINDEX */
c401cc
 
c401cc
 
c401cc
-#if defined(SIOCGIFVLAN) && defined(HAVE_STRUCT_IFREQ) && defined(GET_VLAN_VID_CMD)
c401cc
+#if defined(SIOCGIFVLAN) && defined(HAVE_STRUCT_IFREQ) && HAVE_DECL_GET_VLAN_VID_CMD
c401cc
 int virNetDevGetVLanID(const char *ifname, int *vlanid)
c401cc
 {
c401cc
     struct vlan_ioctl_args vlanargs = {
c401cc
-- 
c401cc
1.8.5.4
c401cc