When the passt backend is used, the ``<backend>`` attribute
``logFile`` can be used to tell the passt process for this interface
-where to write its message log, and the ``<backend>`` attribute
-``upstream`` can tell it to restrict upstream traffic to a particular
-host interface.
+where to write its message log, and the ``<source>`` attribute ``dev``
+can tell it to use a particular host interface to derive the routes
+given to the guest for forwarding traffic upstream.
Additionally, when passt is used, multiple ``<portForward>`` elements
can be added to forward incoming network traffic for the host to this
<devices>
...
<interface type='user'>
- <backend type='passt' logFile='/var/log/passt.log' upstream='eth0'/>
+ <backend type='passt' logFile='/var/log/passt.log'/>
<mac address="00:11:22:33:44:55"/>
+ <source dev='eth0'/>
<ip family='ipv4' address='172.17.2.0' prefix='24'/>
<ip family='ipv6' address='2001:db8:ac10:fd01::' prefix='64'/>
<portForward proto='tcp' address='2001:db8:ac10:fd01::1:10' start='2022'>
g_free(def->ifname_guest_actual);
g_free(def->virtio);
g_free(def->coalesce);
+ g_free(def->sourceDev);
virNetDevIPInfoClear(&def->guestIP);
virNetDevIPInfoClear(&def->hostIP);
}
def->backend.logFile = virXMLPropString(node, "logFile");
- def->backend.upstream = virXMLPropString(node, "upstream");
if (tap)
def->backend.tap = virFileSanitizePath(tap);
break;
case VIR_DOMAIN_NET_TYPE_USER:
+ def->sourceDev = virXMLPropString(source_node, "dev");
+ break;
+
case VIR_DOMAIN_NET_TYPE_NULL:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
return -1;
}
virBufferAsprintf(buf, " mode='%s'", mode);
+ } else if (actualType == VIR_DOMAIN_NET_TYPE_USER) {
+ virBufferEscapeString(buf, " dev='%s'", def->sourceDev);
}
virBufferAddLit(buf, "/>\n");
virBufferEscapeString(&attrBuf, " tap='%s'", backend->tap);
virBufferEscapeString(&attrBuf, " vhost='%s'", backend->vhost);
virBufferEscapeString(&attrBuf, " logFile='%s'", backend->logFile);
- virBufferEscapeString(&attrBuf, " upstream='%s'", backend->upstream);
virXMLFormatElement(buf, "backend", &attrBuf, NULL);
}
}
case VIR_DOMAIN_NET_TYPE_USER:
+ if (def->backend.type == VIR_DOMAIN_NET_BACKEND_PASST &&
+ def->sourceDev) {
+ virBufferEscapeString(buf, "<source dev='%s'", def->sourceDev);
+ sourceLines++;
+ }
+ break;
+
case VIR_DOMAIN_NET_TYPE_NULL:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
virNetDevIPInfo hostIP;
char *ifname_guest_actual;
char *ifname_guest;
+ char *sourceDev;
virNetDevIPInfo guestIP;
size_t nPortForwards;
virDomainNetPortForward **portForwards;
<value>user</value>
</attribute>
<interleave>
+ <optional>
+ <element name="source">
+ <attribute name="dev">
+ <ref name="deviceName"/>
+ </attribute>
+ <empty/>
+ </element>
+ </optional>
<ref name="interface-options"/>
</interleave>
</group>
<ref name="absFilePath"/>
</attribute>
</optional>
- <optional>
- <attribute name="upstream">
- <ref name="deviceName"/>
- </attribute>
- </optional>
</element>
</optional>
<optional>
virCommandAddArgFormat(cmd, "%u", net->mtu);
}
- if (net->backend.upstream)
- virCommandAddArgList(cmd, "--interface", net->backend.upstream, NULL);
+ if (net->sourceDev)
+ virCommandAddArgList(cmd, "--interface", net->sourceDev, NULL);
if (net->backend.logFile)
virCommandAddArgList(cmd, "--log-file", net->backend.logFile, NULL);
<controller type='pci' index='0' model='pci-root'/>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
+ <source dev='eth42'/>
<ip address='172.17.2.0' family='ipv4' prefix='24'/>
<ip address='2001:db8:ac10:fd01::feed' family='ipv6'/>
<portForward proto='tcp' address='2001:db8:ac10:fd01::1:10'>
<range start='443' to='344'/>
</portForward>
<model type='rtl8139'/>
- <backend type='passt' logFile='/var/log/loglaw.blog' upstream='eth42'/>
+ <backend type='passt' logFile='/var/log/loglaw.blog'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</interface>
<input type='mouse' bus='ps2'/>