mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
bhyve: fix crash on missing interface model
The bhyve driver crashes in bhyveBuildNetArgStr() when network interface model is not defined. As it has to be provided explicitly, add a check to report an error if it's missing. Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
1b6ff36c2f
commit
de3fe191f5
@ -56,6 +56,12 @@ bhyveBuildNetArgStr(virConnectPtr conn,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
virDomainNetType actualType = virDomainNetGetActualType(net);
|
virDomainNetType actualType = virDomainNetGetActualType(net);
|
||||||
|
|
||||||
|
if (net->model == NULL) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("NIC model must be specified"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (STREQ(net->model, "virtio")) {
|
if (STREQ(net->model, "virtio")) {
|
||||||
if (VIR_STRDUP(nic_model, "virtio-net") < 0)
|
if (VIR_STRDUP(nic_model, "virtio-net") < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user