提交 a6fbbce7 编写于 作者: M Michal Privoznik

qemuDomainDeviceDefValidateNetwork: Check for range only if IP prefix set

https://bugzilla.redhat.com/show_bug.cgi?id=1515533

The @prefix attribute to <ip/> element for interface type user is
optional. Therefore, if left out it has value of zero in which
case we should not check whether it falls into <4, 27> range.
Otherwise we fail parsing domain XML for no good reason.

Broken by commit b62b8090.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 15498a76
......@@ -4373,7 +4373,8 @@ qemuDomainDeviceDefValidateNetwork(const virDomainNetDef *net)
}
hasIPv4 = true;
if (ip->prefix < 4 || ip->prefix > 27) {
if (ip->prefix > 0 &&
(ip->prefix < 4 || ip->prefix > 27)) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("invalid prefix, must be in range of 4-27"));
return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册