libvirt/0002-network-detect-conflicting-route-even-if-it-is-the-f.patch
Cole Robinson a540751e83 Generate non-colliding network IP range at RPM install time (bz #811967)
Fix directory creation at session daemon startup (bz #1139672)
Disable wireshark building, currently broken on f21/rawhide
2014-09-15 14:52:07 -04:00

33 lines
1.3 KiB
Diff

From ed1efa32c71ba195a16bb63da4ee532d8a6c8a99 Mon Sep 17 00:00:00 2001
From: Laine Stump <laine@laine.org>
Date: Mon, 15 Sep 2014 13:30:08 -0400
Subject: [PATCH] network: detect conflicting route even if it is the final
entry
This is a folloup to commit 5f719596, which checks for a route
conflicting with the standard libvirt default network subnet
(192.168.122.0/24). It turns out that $() strips the trailing newline
from the output of "ip route show", so there would be no match if the
route we were looking for was the final line of output. This can be
solved by adding ${nl} to the end of the output (just as we were
already adding it at the beginning of the output).
(cherry picked from commit 22048ae61dbb7876d17bcf7dbedf9e8d1cf98d4e)
---
libvirt.spec.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 75a91f5..0741c73 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1741,7 +1741,7 @@ if test $1 -eq 1 && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml ;
sub=${orig_sub}
nl='
'
- routes="${nl}$(ip route show | cut -d' ' -f1)"
+ routes="${nl}$(ip route show | cut -d' ' -f1)${nl}"
case ${routes} in
*"${nl}192.168.${orig_sub}.0/24${nl}"*)
# there was a match, so we need to look for an unused subnet