mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
libxl: allow only 'ethernet' and 'bridge' interfaces, allow script there
Actually only those interface types are handled correctly so reject others instead of ignoring settings (i.e. treating as bridge/ethernet anyway). Also allow <script/> in 'ethernet' (which should be the only script-allowing type). Keep <script/> allowed in bridge to be compatible with legacy 'xen' driver. Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
This commit is contained in:
parent
07966f6a8b
commit
2903197539
@ -572,19 +572,21 @@ libxlMakeNic(virDomainNetDefPtr l_nic, libxl_device_nic *x_nic)
|
|||||||
if (VIR_STRDUP(x_nic->ifname, l_nic->ifname) < 0)
|
if (VIR_STRDUP(x_nic->ifname, l_nic->ifname) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (l_nic->type == VIR_DOMAIN_NET_TYPE_BRIDGE) {
|
switch (l_nic->type) {
|
||||||
|
case VIR_DOMAIN_NET_TYPE_BRIDGE:
|
||||||
if (VIR_STRDUP(x_nic->bridge, l_nic->data.bridge.brname) < 0)
|
if (VIR_STRDUP(x_nic->bridge, l_nic->data.bridge.brname) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
/* fallthrough */
|
||||||
|
case VIR_DOMAIN_NET_TYPE_ETHERNET:
|
||||||
if (VIR_STRDUP(x_nic->script, l_nic->script) < 0)
|
if (VIR_STRDUP(x_nic->script, l_nic->script) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
break;
|
||||||
if (l_nic->script) {
|
default:
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("scripts are not supported on interfaces of type %s"),
|
_("libxenlight does not support network device type %s"),
|
||||||
virDomainNetTypeToString(l_nic->type));
|
virDomainNetTypeToString(l_nic->type));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user