[libvirt] [PATCH] tools: Fix a wrong check in cmdEcho()
by Hongwei Bi
What should be checked here is xmlbuf rather then buf.
---
tools/virsh.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index bf2fbf8..ac354ac 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -921,7 +921,7 @@ cmdEcho(vshControl *ctl, const vshCmd *cmd)
if (xml) {
virBufferEscapeString(&xmlbuf, "%s", arg);
- if (virBufferError(&buf)) {
+ if (virBufferError(&xmlbuf)) {
vshPrint(ctl, "%s", _("Failed to allocate XML buffer"));
return false;
}
--
1.7.1
11 years, 3 months
[libvirt] [bug] State of "in shutdown".
by Dongsheng Yang
Hi experts:
I got the following description by <man virsh>:
```
STATES
shutdown
The domain is in the process of shutting down, i.e.
the guest
operating system has been notified and should be in the process of
stopping its operations gracefully.
```
But I found the state of VM is "running" even when it is in process of
shutting down.
e.g:
# virsh list
Id Name State
----------------------------------------------------
41 virt-tests-vm1 running
# virsh shutdown virt-tests-vm1;echo $?;virsh domstate virt-tests-vm1
--reason
Domain virt-tests-vm1 is being shutdown
0
running (booted)
# virsh domstate virt-tests-vm1 --reason
running (booted)
... ...
# virsh domstate virt-tests-vm1 --reason
shut off (shutdown)
As shown above, I can not get a "shutdown" (or "in shutdown") for the VM
state.
Do you think it is a bug, or something not good enough?
Wish your help!!
11 years, 3 months
[libvirt] [PATCHv4 0/4] VMX: CD-ROM handling improvements
by Doug Goldstein
A user came into #virt the other day and was trying to get libvirtd
to work with VMware Fusion 5, which is basically the Mac OS X version of
VMware Workstation. In helping him out I noticed a few limitations of our
VMX parser so I've added support through this patchset. I don't personally
have access or own VMware's product.
v4:
* Half the patchset has been merged at this point
* Add back 'auto detect' support via <source startupPolicy='optional'/>
* Made device='lun' match device='cdrom'
* Patch 1 & 2 are new to the series
v3:
* Dropped 'auto detect' support from series as it needs more work based on
feedback
* Added patch to combine virVMXFormatHardDisk and virVMXFormatCDROM into
one function.
* Converted to <disk type='block' device='lun'> instead of adding a
<driver> element to better match the behavior available via QEMU.
v2:
* Added additional test cases and fixed issues that arose from those
*** BLURB HERE ***
Doug Goldstein (4):
Allow LUN type disks to have no source
Allow <source> for type=block to have no dev
VMX: Add support for 'auto detect' fileNames
VMX: Add a VMWare Fusion 5 configuration for tests
docs/schemas/domaincommon.rng | 8 +-
src/conf/domain_conf.c | 9 ++-
src/vmx/vmx.c | 28 +++++--
.../vmx2xml-cdrom-ide-raw-auto-detect.vmx | 5 ++
.../vmx2xml-cdrom-ide-raw-auto-detect.xml | 24 ++++++
.../vmx2xml-cdrom-scsi-raw-auto-detect.vmx | 6 ++
.../vmx2xml-cdrom-scsi-raw-auto-detect.xml | 24 ++++++
tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.vmx | 88 ++++++++++++++++++++++
tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml | 39 ++++++++++
tests/vmx2xmltest.c | 4 +
.../xml2vmx-cdrom-ide-raw-auto-detect.vmx | 14 ++++
.../xml2vmx-cdrom-ide-raw-auto-detect.xml | 14 ++++
.../xml2vmx-cdrom-scsi-raw-auto-detect.vmx | 15 ++++
.../xml2vmx-cdrom-scsi-raw-auto-detect.xml | 14 ++++
tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx | 30 ++++++++
tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.xml | 41 ++++++++++
tests/xml2vmxtest.c | 4 +
17 files changed, 356 insertions(+), 11 deletions(-)
create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-auto-detect.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-auto-detect.xml
create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-auto-detect.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-auto-detect.xml
create mode 100644 tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml
create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-auto-detect.vmx
create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-auto-detect.xml
create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-auto-detect.vmx
create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-auto-detect.xml
create mode 100644 tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx
create mode 100644 tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.xml
--
1.8.1.5
11 years, 3 months
[libvirt] [PATCHv3 0/4] Introduce APIs to extract DHCP leases info
by Nehal J Wani
This API returns the leases information stored in the DHCP leases
file of dnsmasq for a given virtual network. It contacts the
bridge network driver, which parses the leases file.
It supports two methods:
1. Return info for all network interfaces connected to a given
virtual network
2. Return information for a particular network interface in a
given virtual network by providing its MAC Address
v3
* Mostly small nits, change in MACRO names, use of virSocketAddrGetIpPrefix to
retrieve IP prefix from @dom XML.
v2
* Since DHCPv6 is supposed to be suported in future, virNetworkGetDHCPLeasesForMAC
changed, prefix and virIPAddrType added in virNetworkDHCPLeases struct.
Refer: https://www.redhat.com/archives/libvir-list/2013-September/msg00732.html
v1
* Refer: https://www.redhat.com/archives/libvir-list/2013-September/msg00620.html
* The need for these APIs were result of a RFC was proposed on the list.
Refer: http://www.redhat.com/archives/libvir-list/2013-July/msg01603.html
Nehal J Wani (4):
net-dhcp-leases: Implement the public APIs
net-dhcp-leases: Implement the remote protocol
net-dhcp-leases: Private implementation inside network driver
net-dhcp-leases: Add virsh support
daemon/remote.c | 133 ++++++++++++++++++++++++++++++++
include/libvirt/libvirt.h.in | 33 ++++++++
python/generator.py | 3 +
src/driver.h | 13 ++++
src/libvirt.c | 173 ++++++++++++++++++++++++++++++++++++++++++
src/libvirt_public.syms | 7 ++
src/network/bridge_driver.c | 177 +++++++++++++++++++++++++++++++++++++++++++
src/remote/remote_driver.c | 150 ++++++++++++++++++++++++++++++++++++
src/remote/remote_protocol.x | 50 +++++++++++-
src/remote_protocol-structs | 32 ++++++++
src/rpc/gendispatch.pl | 1 +
tools/virsh-network.c | 100 ++++++++++++++++++++++++
tools/virsh.pod | 6 ++
13 files changed, 877 insertions(+), 1 deletion(-)
--
1.7.11.7
11 years, 3 months
[libvirt] [PATCH] Free slicename in virSystemdCreateMachine
by Ján Tomko
1,003 bytes in 1 blocks are definitely lost in loss record 599 of 635
==404== by 0x50728A7: virBufferAddChar (virbuffer.c:185)
==404== by 0x50BC466: virSystemdEscapeName (virsystemd.c:67)
==404== by 0x50BC6B2: virSystemdMakeSliceName (virsystemd.c:108)
==404== by 0x50BC870: virSystemdCreateMachine (virsystemd.c:169)
==404== by 0x5078267: virCgroupNewMachine (vircgroup.c:1498)
---
src/util/virsystemd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 7674cc6..e72b7f0 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -239,5 +239,6 @@ cleanup:
VIR_FREE(username);
VIR_FREE(creatorname);
VIR_FREE(machinename);
+ VIR_FREE(slicename);
return ret;
}
--
1.8.1.5
11 years, 3 months
[libvirt] [PATCH] Always free network and graphics cookies
by Ján Tomko
qemuMigrationEatCookie has flags to control if these should
be parsed, but it does not fill mig->flags. These cookies might
get leaked if these flags are not set by qemuMigrationBakeCookie.
42 (32 direct, 10 indirect) bytes in 1 blocks are definitely lost in
loss record 361 of 662
==123== by 0x1BA33FCA: qemuMigrationEatCookie (qemu_migration.c:678)
==123== by 0x1BA34A1E: qemuMigrationRun (qemu_migration.c:3108)
==123== by 0x1BA3622B: doNativeMigrate (qemu_migration.c:3343)
==123== by 0x1BA3B408: qemuMigrationPerform (qemu_migration.c:4138)
---
src/qemu/qemu_migration.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 69a9013..d7b89fc 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -202,11 +202,8 @@ static void qemuMigrationCookieFree(qemuMigrationCookiePtr mig)
if (!mig)
return;
- if (mig->flags & QEMU_MIGRATION_COOKIE_GRAPHICS)
- qemuMigrationCookieGraphicsFree(mig->graphics);
-
- if (mig->flags & QEMU_MIGRATION_COOKIE_NETWORK)
- qemuMigrationCookieNetworkFree(mig->network);
+ qemuMigrationCookieGraphicsFree(mig->graphics);
+ qemuMigrationCookieNetworkFree(mig->network);
VIR_FREE(mig->localHostname);
VIR_FREE(mig->remoteHostname);
--
1.8.1.5
11 years, 3 months
[libvirt] [PATCHv2] build: make autobuild require rpm build deps
by Eric Blake
I spent far too long on a new machine trying to figure out why
./autobuild.sh failed due to an rpm build failure (complaining
that libvirt_parthelper was supposed to be packaged but was not
built), and finally traced it to a missing parted-devel
installation. I learned that --nodeps is in place for
autobuilder setups, but for developers, removing it would make
rpmbuild error out much sooner for a less cryptic failure.
* autobuild.sh: Conditionally drop --nodeps from rpmbuild lines.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
v2: make --nodeps conditional based on $AUTOBUILD_COUNTER; suggested
by Dan Berrange.
autobuild.sh | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/autobuild.sh b/autobuild.sh
index e5aa35c..3109b49 100755
--- a/autobuild.sh
+++ b/autobuild.sh
@@ -8,6 +8,13 @@ set -v
test -n "$1" && RESULTS=$1 || RESULTS=results.log
: ${AUTOBUILD_INSTALL_ROOT=$HOME/builder}
+# If run under the autobuilder, we must use --nodeps with rpmbuild;
+# but this can lead to odd error diagnosis for normal development.
+nodeps=
+if test "${AUTOBUILD_COUNTER+set}"; then
+ nodeps=--nodeps
+fi
+
test -f Makefile && make -k distclean || :
rm -rf coverage
@@ -60,7 +67,7 @@ else
fi
if test -f /usr/bin/rpmbuild ; then
- rpmbuild --nodeps \
+ rpmbuild $nodeps \
--define "extra_release $EXTRA_RELEASE" \
--define "_sourcedir `pwd`" \
-ba --clean libvirt.spec
@@ -111,7 +118,7 @@ fi
if test -x /usr/bin/i686-w64-mingw32-gcc && test -x /usr/bin/x86_64-w64-mingw32-gcc ; then
if test -f /usr/bin/rpmbuild ; then
- rpmbuild --nodeps \
+ rpmbuild $nodeps \
--define "extra_release $EXTRA_RELEASE" \
--define "_sourcedir `pwd`" \
-ba --clean mingw-libvirt.spec
--
1.8.3.1
11 years, 3 months
[libvirt] [PATCHv2] cgroup: Move [qemu|lxc]GetCpuBWStatus to vicgroup.c and refactor it
by Peter Krempa
The function existed in two identical instances in lxc and qemu. Move it
to vircgroup.c and simplify it. Refactor the callers too.
---
Notes:
Version 2:
- added a fallback implementation that doesn't spam logs with errors
src/libvirt_private.syms | 1 +
src/lxc/lxc_driver.c | 52 +++++-------------------------------------------
src/qemu/qemu_driver.c | 51 +++++------------------------------------------
src/util/vircgroup.c | 38 +++++++++++++++++++++++++++++++++++
src/util/vircgroup.h | 2 ++
5 files changed, 51 insertions(+), 93 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 35f0f1b..82e3d6f 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1217,6 +1217,7 @@ virCgroupSetMemory;
virCgroupSetMemoryHardLimit;
virCgroupSetMemorySoftLimit;
virCgroupSetMemSwapHardLimit;
+virCgroupSupportsCpuBW;
# util/virclosecallbacks.h
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index b587c22..87ced95 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1574,45 +1574,10 @@ static char *lxcConnectGetHostname(virConnectPtr conn)
}
-
-/*
- * check whether the host supports CFS bandwidth
- *
- * Return 1 when CFS bandwidth is supported, 0 when CFS bandwidth is not
- * supported, -1 on error.
- */
-static int lxcGetCpuBWStatus(virCgroupPtr cgroup)
-{
- char *cfs_period_path = NULL;
- int ret = -1;
-
- if (!cgroup)
- return 0;
-
- if (virCgroupPathOfController(cgroup, VIR_CGROUP_CONTROLLER_CPU,
- "cpu.cfs_period_us", &cfs_period_path) < 0) {
- VIR_INFO("cannot get the path of cgroup CPU controller");
- ret = 0;
- goto cleanup;
- }
-
- if (access(cfs_period_path, F_OK) < 0) {
- ret = 0;
- } else {
- ret = 1;
- }
-
-cleanup:
- VIR_FREE(cfs_period_path);
- return ret;
-}
-
-
static char *lxcDomainGetSchedulerType(virDomainPtr dom,
int *nparams)
{
char *ret = NULL;
- int rc;
virDomainObjPtr vm;
virLXCDomainObjPrivatePtr priv;
@@ -1639,13 +1604,10 @@ static char *lxcDomainGetSchedulerType(virDomainPtr dom,
}
if (nparams) {
- rc = lxcGetCpuBWStatus(priv->cgroup);
- if (rc < 0)
- goto cleanup;
- else if (rc == 0)
- *nparams = 1;
- else
+ if (virCgroupSupportsCpuBW(priv->cgroup))
*nparams = 3;
+ else
+ *nparams = 1;
}
ignore_value(VIR_STRDUP(ret, "posix"));
@@ -1872,12 +1834,8 @@ lxcDomainGetSchedulerParametersFlags(virDomainPtr dom,
if (virDomainGetSchedulerParametersFlagsEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
- if (*nparams > 1) {
- rc = lxcGetCpuBWStatus(priv->cgroup);
- if (rc < 0)
- goto cleanup;
- cpu_bw_status = !!rc;
- }
+ if (*nparams > 1)
+ cpu_bw_status = virCgroupSupportsCpuBW(priv->cgroup);
if (!(caps = virLXCDriverGetCapabilities(driver, false)))
goto cleanup;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ae1948f..0caeb08 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7325,44 +7325,10 @@ cleanup:
}
-/*
- * check whether the host supports CFS bandwidth
- *
- * Return 1 when CFS bandwidth is supported, 0 when CFS bandwidth is not
- * supported, -1 on error.
- */
-static int qemuGetCpuBWStatus(virCgroupPtr cgroup)
-{
- char *cfs_period_path = NULL;
- int ret = -1;
-
- if (!cgroup)
- return 0;
-
- if (virCgroupPathOfController(cgroup, VIR_CGROUP_CONTROLLER_CPU,
- "cpu.cfs_period_us", &cfs_period_path) < 0) {
- VIR_INFO("cannot get the path of cgroup CPU controller");
- ret = 0;
- goto cleanup;
- }
-
- if (access(cfs_period_path, F_OK) < 0) {
- ret = 0;
- } else {
- ret = 1;
- }
-
-cleanup:
- VIR_FREE(cfs_period_path);
- return ret;
-}
-
-
static char *qemuDomainGetSchedulerType(virDomainPtr dom,
int *nparams)
{
char *ret = NULL;
- int rc;
virDomainObjPtr vm = NULL;
qemuDomainObjPrivatePtr priv;
@@ -7389,13 +7355,10 @@ static char *qemuDomainGetSchedulerType(virDomainPtr dom,
}
if (nparams) {
- rc = qemuGetCpuBWStatus(priv->cgroup);
- if (rc < 0)
- goto cleanup;
- else if (rc == 0)
- *nparams = 1;
- else
+ if (virCgroupSupportsCpuBW(priv->cgroup))
*nparams = 5;
+ else
+ *nparams = 1;
}
ignore_value(VIR_STRDUP(ret, "posix"));
@@ -8728,12 +8691,8 @@ qemuDomainGetSchedulerParametersFlags(virDomainPtr dom,
if (virDomainGetSchedulerParametersFlagsEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
- if (*nparams > 1) {
- rc = qemuGetCpuBWStatus(priv->cgroup);
- if (rc < 0)
- goto cleanup;
- cpu_bw_status = !!rc;
- }
+ if (*nparams > 1)
+ cpu_bw_status = virCgroupSupportsCpuBW(priv->cgroup);
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
goto cleanup;
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index a615f28..e99caf5 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -3061,6 +3061,36 @@ cleanup:
}
+/**
+ * virCgroupSupportsCpuBW():
+ * Check whether the host supports CFS bandwidth.
+ *
+ * Return true when CFS bandwidth is supported,
+ * false when CFS bandwidth is not supported.
+ */
+bool
+virCgroupSupportsCpuBW(virCgroupPtr cgroup)
+{
+ char *path = NULL;
+ int ret = false;
+
+ if (!cgroup)
+ return false;
+
+ if (virCgroupPathOfController(cgroup, VIR_CGROUP_CONTROLLER_CPU,
+ "cpu.cfs_period_us", &path) < 0) {
+ virResetLastError();
+ goto cleanup;
+ }
+
+ ret = virFileExists(path);
+
+cleanup:
+ VIR_FREE(path);
+ return ret;
+}
+
+
#else /* !VIR_CGROUP_SUPPORTED */
bool
@@ -3646,4 +3676,12 @@ virCgroupIsolateMount(virCgroupPtr group ATTRIBUTE_UNUSED,
return -1;
}
+
+bool
+virCgroupSupportsCpuBW(virCgroupPtr cgroup ATTRIBUTE_UNUSED)
+{
+ VIR_DEBUG("Control groups not supported on this platform");
+ return false;
+}
+
#endif /* !VIR_CGROUP_SUPPORTED */
diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h
index 7bb4b2a..835eb30 100644
--- a/src/util/vircgroup.h
+++ b/src/util/vircgroup.h
@@ -207,4 +207,6 @@ int virCgroupIsolateMount(virCgroupPtr group,
const char *oldroot,
const char *mountopts);
+bool virCgroupSupportsCpuBW(virCgroupPtr cgroup);
+
#endif /* __VIR_CGROUP_H__ */
--
1.8.3.2
11 years, 3 months
[libvirt] [PATCH] build: fix build with latest rawhide kernel headers
by Eric Blake
Bother those kernel developers. In the latest rawhide, kernel
and glibc have now been unified so that <netinet/in.h> and
<linux/in6.h> no longer clash; but <linux/if_bridge.h> is still
not self-contained. Because of the latest header change, the
build is failing with:
checking for linux/param.h... no
configure: error: You must install kernel-headers in order to compile libvirt with QEMU or LXC support
with details:
In file included from conftest.c:561:0:
/usr/include/linux/in6.h:71:18: error: field 'flr_dst' has incomplete type
struct in6_addr flr_dst;
We need a workaround to avoid our workaround :)
* configure.ac (KERNEL_HEADERS_WORKAROUND): New test.
* src/util/virnetdevbridge.c (includes): Use it.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
This qualifies as a build-breaker; but last time I pushed a patch
in this area of code without review, it got reverted, so I'll wait
for the review.
I've tested on RHEL 5, RHEL 6, Fedora 19 (all of which have glibc
and kernel differences, although not the same error messages) and
rawhide (where glibc and kernel finally agree, but where the kernel
headers _still_ assume that the caller already declared ipv6 structs).
configure.ac | 38 ++++++++++++++++++++++++++++----------
src/util/virnetdevbridge.c | 24 ++++++++++++++----------
2 files changed, 42 insertions(+), 20 deletions(-)
diff --git a/configure.ac b/configure.ac
index 8426863..8acccdd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1051,18 +1051,36 @@ dnl check for kernel headers required by src/bridge.c
dnl
if test "$with_linux" = "yes"; then
if test "$with_qemu" = "yes" || test "$with_lxc" = "yes" ; then
+ # Various kernel versions have headers that are not self-standing, but
+ # yet are incompatible with the corresponding glibc headers. In order
+ # to guarantee compilation across a wide range of versions (from RHEL 5
+ # to rawhide), we first have to probe whether glibc and kernel can be
+ # used in tandem; and if not, provide workarounds that ensure that
+ # ABI-compatible IPv6 types are present for use by the kernel headers.
+ # These probes mirror the usage in virnetdevbridge.c
+ AC_CACHE_CHECK([whether kernel and glibc headers are compatible],
+ [lv_cv_kernel_glibc_compatible],
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <netinet/in.h>
+ #include <linux/in6.h>
+ ]])],
+ [lv_cv_kernel_glibc_compatible=yes],
+ [lv_cv_kernel_glibc_compatible=no])])
+ if test "x$lv_cv_kernel_glibc_compatible" != xyes; then
+ AC_DEFINE([KERNEL_HEADERS_WORKAROUND], [1],
+ [define to 1 if Linux kernel headers require a workaround to avoid
+ compilation errors when mixed with glibc headers])
+ fi
AC_CHECK_HEADERS([linux/param.h linux/sockios.h linux/if_bridge.h linux/if_tun.h],,
[AC_MSG_ERROR([You must install kernel-headers in order to compile libvirt with QEMU or LXC support])],
- [[/* The kernel folks broke their headers when used with particular
- * glibc versions; although the structs are ABI compatible, the
- * C type system doesn't like struct redefinitions. We work around
- * the problem here in the same manner as in virnetdevbridge.c. */
- #include <netinet/in.h>
- #define in6_addr in6_addr_
- #define sockaddr_in6 sockaddr_in6_
- #define ipv6_mreq ipv6_mreq_
- #define in6addr_any in6addr_any_
- #define in6addr_loopback in6addr_loopback_
+ [[#include <netinet/in.h>
+ #if KERNEL_HEADERS_WORKAROUND
+ # define in6_addr in6_addr_
+ # define sockaddr_in6 sockaddr_in6_
+ # define ipv6_mreq ipv6_mreq_
+ # define in6addr_any in6addr_any_
+ # define in6addr_loopback in6addr_loopback_
+ #endif
#include <linux/in6.h>
]])
fi
diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c
index e4daa27..b78ab07 100644
--- a/src/util/virnetdevbridge.c
+++ b/src/util/virnetdevbridge.c
@@ -39,22 +39,26 @@
#ifdef __linux__
# include <linux/sockios.h>
# include <linux/param.h> /* HZ */
+# if KERNEL_HEADERS_WORKAROUND
/* Depending on the version of kernel vs. glibc, there may be a collision
* between <net/in.h> and kernel IPv6 structures. The different types
* are ABI compatible, but choke the C type system; work around it by
* using temporary redefinitions. */
-# define in6_addr in6_addr_
-# define sockaddr_in6 sockaddr_in6_
-# define ipv6_mreq ipv6_mreq_
-# define in6addr_any in6addr_any_
-# define in6addr_loopback in6addr_loopback_
+# define in6_addr in6_addr_
+# define sockaddr_in6 sockaddr_in6_
+# define ipv6_mreq ipv6_mreq_
+# define in6addr_any in6addr_any_
+# define in6addr_loopback in6addr_loopback_
+# endif
# include <linux/in6.h>
# include <linux/if_bridge.h> /* SYSFS_BRIDGE_ATTR */
-# undef in6_addr
-# undef sockaddr_in6
-# undef ipv6_mreq
-# undef in6addr_any
-# undef in6addr_loopback
+# if KERNEL_HEADERS_WORKAROUND
+# undef in6_addr
+# undef sockaddr_in6
+# undef ipv6_mreq
+# undef in6addr_any
+# undef in6addr_loopback
+# endif
# define JIFFIES_TO_MS(j) (((j)*1000)/HZ)
# define MS_TO_JIFFIES(ms) (((ms)*HZ)/1000)
--
1.8.3.1
11 years, 3 months