Rebased to version 2.2.1

Fix spice port allocation collisions (bz #1390413)
Fix rpm validation of nwfilter config files (bz #1431581)
Tie virtlogd lifecycle to libvirtd.service (bz #1435855)
Fix double free when undefining storage pool (bz #1436400)
Fix crash in qemuDomainSecretDiskPrepare (bz #1438070)
This commit is contained in:
Cole Robinson 2017-05-10 18:01:32 -04:00
parent 997d61802f
commit 598f426d2a
3 changed files with 36 additions and 76 deletions

View File

@ -1,67 +0,0 @@
From: Laine Stump <laine@laine.org>
Date: Fri, 28 Oct 2016 11:43:56 -0400
Subject: [PATCH] network: fix endless loop when starting network with multiple
IPs and no dhcp
commit 9065cfaa added the ability to disable DNS services for a
libvirt virtual network. If neither DNS nor DHCP is needed for a
network, then we don't need to start dnsmasq, so code was added to
check for this.
Unfortunately, it was written with a great lack of attention to detail
(I can say that, because I was the author), and the loop that checked
if DHCP is needed for the network would never end if the network had
multiple IP addresses and the first <ip> had no <dhcp> subelement
(which would have contained a <range> or <host> subelement, thus
requiring DHCP services).
This patch rewrites the check to be more compact and (more
importantly) finite.
This bug was present in release 2.2.0 and 2.3.0, so will need to be
backported to any relevant maintainence branches.
Reported here:
https://www.redhat.com/archives/libvirt-users/2016-October/msg00032.html
https://www.redhat.com/archives/libvirt-users/2016-October/msg00045.html
(cherry picked from commit bbb333e4813ebe74580e75b0e8c2eb325e3d11ca)
---
src/network/bridge_driver.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 7b99aca..3cf349e 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -1408,20 +1408,22 @@ networkStartDhcpDaemon(virNetworkDriverStatePtr driver,
int ret = -1;
dnsmasqContext *dctx = NULL;
- if (!(ipdef = virNetworkDefGetIPByIndex(network->def, AF_UNSPEC, 0))) {
- /* no IP addresses, so we don't need to run */
- ret = 0;
- goto cleanup;
- }
-
/* see if there are any IP addresses that need a dhcp server */
- for (i = 0; ipdef && !needDnsmasq;
- ipdef = virNetworkDefGetIPByIndex(network->def, AF_UNSPEC, i + 1)) {
+ i = 0;
+ while ((ipdef = virNetworkDefGetIPByIndex(network->def, AF_UNSPEC, i))) {
+ i++;
if (ipdef->nranges || ipdef->nhosts)
needDnsmasq = true;
}
+ if (i == 0) {
+ /* no IP addresses at all, so we don't need to run */
+ ret = 0;
+ goto cleanup;
+ }
+
if (!needDnsmasq && network->def->dns.enable == VIR_TRISTATE_BOOL_NO) {
+ /* no DHCP services needed, and user disabled DNS service */
ret = 0;
goto cleanup;
}

View File

@ -219,22 +219,18 @@
Summary: Library providing a simple virtualization API
Name: libvirt
Version: 2.2.0
Release: 2%{?dist}%{?extra_release}
Version: 2.2.1
Release: 1%{?dist}%{?extra_release}
License: LGPLv2+
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
URL: http://libvirt.org/
%if %(echo %{version} | grep -o \\. | wc -l) == 3
%if %(echo %{version} | grep -q "\.0$"; echo $?) == 1
%define mainturl stable_updates/
%endif
Source: http://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.xz
# Fix libvirtd endless loop when starting network with multiple IPs (bz
# #1393975)
Patch0001: 0001-network-fix-endless-loop-when-starting-network-with-.patch
Requires: libvirt-daemon = %{version}-%{release}
Requires: libvirt-daemon-config-network = %{version}-%{release}
Requires: libvirt-daemon-config-nwfilter = %{version}-%{release}
@ -416,6 +412,9 @@ BuildRequires: numad
%if %{with_wireshark}
%if 0%{fedora} >= 24
BuildRequires: wireshark-devel >= 2.1.0
# Temp hack for F25 due to broken wireshark-devel deps
# https://bugzilla.redhat.com/show_bug.cgi?id=1401463
BuildRequires: qt-devel glib2-devel
%else
BuildRequires: wireshark-devel >= 1.12.1
%endif
@ -1242,6 +1241,13 @@ cp $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/default.xml \
$RPM_BUILD_ROOT%{_datadir}/libvirt/networks/default.xml
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/default.xml
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml
# nwfilter files are installed in /usr/share/libvirt and copied to /etc in %post
# to avoid verification errors on changed files in /etc
install -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/libvirt/nwfilter/
cp -a $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/nwfilter/*.xml \
$RPM_BUILD_ROOT%{_datadir}/libvirt/nwfilter/
# Strip auto-generated UUID - we need it generated per-install
sed -i -e "/<uuid>/d" $RPM_BUILD_ROOT%{_datadir}/libvirt/networks/default.xml
%if ! %{with_qemu}
@ -1469,6 +1475,17 @@ if test $1 -eq 1 && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml ;
fi
%post daemon-config-nwfilter
cp %{_datadir}/libvirt/nwfilter/*.xml %{_sysconfdir}/libvirt/nwfilter/
# Make sure libvirt picks up the new nwfilter defininitons
%if %{with_systemd}
/bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 ||:
%else
/sbin/service libvirtd condrestart > /dev/null 2>&1 || :
%endif
%if %{with_systemd}
%triggerun -- libvirt < 0.9.4
%{_bindir}/systemd-sysv-convert --save libvirtd >/dev/null 2>&1 ||:
@ -1649,7 +1666,9 @@ exit 0
%{_datadir}/libvirt/networks/default.xml
%files daemon-config-nwfilter
%{_sysconfdir}/libvirt/nwfilter/*.xml
%dir %{_datadir}/libvirt/nwfilter/
%{_datadir}/libvirt/nwfilter/*.xml
%ghost %{_sysconfdir}/libvirt/nwfilter/*.xml
%files daemon-driver-interface
%{_libdir}/%{name}/connection-driver/libvirt_driver_interface.so
@ -1895,6 +1914,14 @@ exit 0
%changelog
* Wed May 10 2017 Cole Robinson <crobinso@redhat.com> - 2.2.1-1
- Rebased to version 2.2.1
- Fix spice port allocation collisions (bz #1390413)
- Fix rpm validation of nwfilter config files (bz #1431581)
- Tie virtlogd lifecycle to libvirtd.service (bz #1435855)
- Fix double free when undefining storage pool (bz #1436400)
- Fix crash in qemuDomainSecretDiskPrepare (bz #1438070)
* Mon Nov 14 2016 Cole Robinson <crobinso@redhat.com> - 2.2.0-2
- Fix libvirtd endless loop when starting network with multiple IPs (bz
#1393975)

View File

@ -1 +1 @@
2462e768e1518026c3105a0466b5fece libvirt-2.2.0.tar.xz
SHA512 (libvirt-2.2.1.tar.xz) = b89a2665bea81c440afc3f9f69c26e314344f1f2fbf53f82b25bdddcc89532ddf3393902e9cf552edb827ce5d8b46b9214b5a25303b19cf0f3f085131d870518