For tuning the backend of the network, the <code>backend</code> element
can be used. The <code>vhost</code> attribute can override the default vhost
device path (<code>/dev/vhost-net</code>) for devices with <code>virtio</code> model.
- Supported attributes are <code>tap</code> and <code>vhost</code>,
- allowing to override the default devices for creating tap and vhost devices.
+ The <code>tap</code> attribute overrides the tun/tap device path (default:
+ <code>/dev/net/tun</code>) for network and bridge interfaces. This does not work
+ in session mode.
</p>
<h5><a name="elementsNICSTargetOverride">Overriding the target element</a></h5>
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
const char *tunpath = "/dev/net/tun";
- if (net->backend.tap)
+ if (net->backend.tap) {
tunpath = net->backend.tap;
+ if (!cfg->privileged) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("cannot use custom tap device in session mode"));
+ goto cleanup;
+ }
+ }
if (!(brname = virDomainNetGetActualBridgeName(net))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing bridge name"));
return -1;
}
+ if (net->backend.tap &&
+ !(actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
+ actualType == VIR_DOMAIN_NET_TYPE_BRIDGE)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Custom tap device path is not supported for: %s"),
+ virDomainNetTypeToString(actualType));
+ return -1;
+ }
+
if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) {
tapfdSize = net->driver.virtio.queues;