mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
network: detect conflicting route even if it is the final entry
This is a folloup to commit5f719596
, 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 commit22048ae61d
)
This commit is contained in:
parent
78503276c1
commit
f6f9edf13c
@ -1737,7 +1737,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
|
||||
|
Loading…
Reference in New Issue
Block a user