On 06/22/2011 04:31 PM, Eric Blake wrote:
On 06/21/2011 06:05 PM, Stefan Berger wrote:
In a second cleanup step this patch makes several interface functions
from macvtap.c commonly available by moving them into interface.c and
prefixing their names with 'iface'.
---
src/libvirt_private.syms | 8
src/util/interface.c | 609 +++++++++++++++++++++++++++++++++++++++++++++++
src/util/interface.h | 37 ++
src/util/macvtap.c | 495 --------------------------------------
4 files changed, 663 insertions(+), 486 deletions(-)
Unfortunately, this breaks things when compiling on RHEL 5. There,
macvtap.c was not compiled, but interface.c is compiled, and I'm now
getting errors like this:
util/interface.c: In function 'ifaceMacvtapLinkAdd':
util/interface.c:538: warning: assignment makes pointer from integer
without a cast
util/interface.c:557: error: 'IFLA_LINKINJFO' undeclared (first use in
this function)
...
We need some preprocessor conditionals to filter out these functions
when support is lacking.
My fault. We had it compiled conditionally before and I took it out of
the #if WITH_MACVTAP.
Does this patch here make it work?
---
src/util/interface.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
Index: libvirt-acl/src/util/interface.c
===================================================================
--- libvirt-acl.orig/src/util/interface.c
+++ libvirt-acl/src/util/interface.c
@@ -510,7 +510,7 @@ ifaceSetMacaddr(const char *ifname ATTRI
*
* Returns 0 on success, -1 on fatal error.
*/
-#if __linux__
+#if defined(__linux__) && defined(WITH_MACVTAP)
int
ifaceMacvtapLinkAdd(const char *type,
const unsigned char *macaddress, int macaddrsize,
@@ -649,8 +649,14 @@ ifaceMacvtapLinkAdd(const char *type ATT
int *retry ATTRIBUTE_UNUSED)
{
ifaceError(VIR_ERR_INTERNAL_ERROR, "%s",
+# if defined(__linux__) && !defined (WITH_MACVTAP)
+ _("ifaceMacvtapLinkAdd is not supported since include
files "
+ "were too old"));
+# else
_("ifaceMacvtapLinkAdd is not supported on non-linux "
"platforms"));
+# endif
+
return -1;
}
@@ -758,7 +764,8 @@ ifaceLinkDel(const char *ifname ATTRIBUT
#endif
-#if __linux__
+#if defined(__linux__) && defined(IFLA_PORT_MAX)
+
static struct nla_policy ifla_policy[IFLA_MAX + 1] =
{
[IFLA_VF_PORTS] = { .type = NLA_NESTED },
@@ -894,8 +901,14 @@ ifaceMacvtapLinkDump(bool nltarget_kerne
uint32_t (*getPidFunc)(void) ATTRIBUTE_UNUSED)
{
ifaceError(VIR_ERR_INTERNAL_ERROR, "%s",
+# if defined(__linux__) && !defined(IFLA_PORT_MAX)
+ _("ifaceMacvtapLinkDump is not supported since include
files "
+ "were too old"));
+# else
_("ifaceMacvtapLinkDump is not supported on non-linux "
"platforms"));
+# endif
+
return -1;
}
Stefan
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list