2017-08-24 21:13:59 +02:00
|
|
|
# -*- Mode: Python -*-
|
2020-07-29 20:50:24 +02:00
|
|
|
# vim: filetype=python
|
2017-08-24 21:13:59 +02:00
|
|
|
#
|
|
|
|
|
|
|
|
##
|
|
|
|
# = Net devices
|
|
|
|
##
|
|
|
|
|
|
|
|
{ 'include': 'common.json' }
|
|
|
|
|
|
|
|
##
|
|
|
|
# @set_link:
|
|
|
|
#
|
|
|
|
# Sets the link status of a virtual network adapter.
|
|
|
|
#
|
|
|
|
# @name: the device name of the virtual network adapter
|
|
|
|
#
|
|
|
|
# @up: true to set the link status to be up
|
|
|
|
#
|
|
|
|
# Returns: Nothing on success
|
|
|
|
# If @name is not a valid network device, DeviceNotFound
|
|
|
|
#
|
|
|
|
# Since: 0.14.0
|
|
|
|
#
|
|
|
|
# Notes: Not all network adapters support setting link status. This command
|
|
|
|
# will succeed even if the network adapter does not support link status
|
|
|
|
# notification.
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
#
|
|
|
|
# -> { "execute": "set_link",
|
|
|
|
# "arguments": { "name": "e1000.0", "up": false } }
|
|
|
|
# <- { "return": {} }
|
|
|
|
#
|
|
|
|
##
|
|
|
|
{ 'command': 'set_link', 'data': {'name': 'str', 'up': 'bool'} }
|
|
|
|
|
|
|
|
##
|
|
|
|
# @netdev_add:
|
|
|
|
#
|
|
|
|
# Add a network backend.
|
|
|
|
#
|
|
|
|
# Additional arguments depend on the type.
|
|
|
|
#
|
|
|
|
# Since: 0.14.0
|
|
|
|
#
|
|
|
|
# Returns: Nothing on success
|
|
|
|
# If @type is not a valid network backend, DeviceNotFound
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
#
|
|
|
|
# -> { "execute": "netdev_add",
|
|
|
|
# "arguments": { "type": "user", "id": "netdev1",
|
|
|
|
# "dnssearch": "example.org" } }
|
|
|
|
# <- { "return": {} }
|
|
|
|
#
|
|
|
|
##
|
net: Complete qapi-fication of netdev_add
We've had all the required pieces for doing a type-safe representation
of netdev_add as a flat union for quite some time now (since
0e55c381f6 in v2.7.0, released in 2016), but did not make the final
switch to using it because of concern about whether a command-line
regression in accepting "1" in place of 1 for integer arguments would
be problematic. Back then, we did not have the deprecation cycle to
allow us to make progress. But now that we have waited so long, other
problems have crept in: for example, our desire to add
qemu-storage-daemon is hampered by the inability to express net
objects, and we are unable to introspect what we actually accept.
Additionally, our round-trip through QemuOpts silently eats any
argument that expands to an array, rendering dnssearch, hostfwd, and
guestfwd useless through QMP:
{"execute": "netdev_add", "arguments": { "id": "netdev0",
"type": "user", "dnssearch": [
{ "str": "8.8.8.8" }, { "str": "8.8.4.4" }
]}}
So without further ado, let's turn on proper QAPI. netdev_add() was a
trivial wrapper around net_client_init(), which did a few steps prior
to calling net_client_init1(); with this patch, we now skip directly
to net_client_init1(). In addition to fixing array parameters, the
following additional differences occur:
- {"execute": "netdev_add", "arguments": {"type": "help"}}
no longer attempts to print help to stdout and exit. Bug fix, broken
in 547203ead4 'net: List available netdevs with "-netdev help"',
v2.12.0.
- {"execute": "netdev_add", "arguments': {... "ipv6-net": "..." }}
no longer attempts to desugar the undocumented ipv6-net magic string
into the proper "ipv6-prefix" and "ipv6-prefixlen". Undocumented
misfeature, introduced in commit 7aac531ef2 "qapi-schema, qemu-options
& slirp: Adding Qemu options for IPv6 addresses", v2.6.0.
- {'execute':'netdev_add',
'arguments':{'id':'net2', 'type':'hubport', 'hubid':"2"}}
{"error": {"class": "GenericError", "desc": "Invalid parameter type for 'hubid', expected: integer"}}
Used to succeed: since our command line treats everything as strings,
our not-so-round-trip conversion from QAPI -> QemuOpts -> QAPI lost
the original typing and turned everything into a string; now that we
skip the QemuOpts, the JSON input has to match the exact QAPI type.
But this stricter QMP is desirable, and introspection is sufficient
for any affected applications to make sure they use it correctly.
In qmp_netdev_add(), we still have to create a QemuOpts object so that
qmp_netdev_del() will be able to remove a hotplugged network device;
but the opts->head remains empty since we now manage all parsing
through the QAPI object rather than QemuOpts; a separate patch will
address the abuse of QemuOpts as a witness for whether a
NetClientState is a netdev. In the meantime, our argument that we are
okay requires auditing all uses of option group "netdev":
- qemu_netdev_opts: option group definition, empty .desc[]
- CLI (CLI netdev parsing ends before monitors start, so while
monitors can mess with CLI netdevs, CLI cannot mess with
monitor netdevs):
- main() case QEMU_OPTION_netdev: store CLI definition
- main() case QEMU_OPTION_readconfig, case QEMU_OPTION_writeconfig:
similar, dealing only with CLI
- net_init_clients(): Pass CLI to net_client_init()
- Monitor:
- hmp_netdev_add(): straightforward parse into net_client_init()
- qmp_netdev_add(): subject of this patch, used to add full
object to option group, now just adds bare-bones id
- qmp_netdev_del(), netdev_del_completion(): check the option group
solely for id, as a 'is this a netdev' predicate
Reported-by: Alex Kirillov <lekiravi@yandex-team.ru>
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200317201711.322764-2-eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Commit message typo fixed]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-03-17 21:17:10 +01:00
|
|
|
{ 'command': 'netdev_add', 'data': 'Netdev', 'boxed': true }
|
2017-08-24 21:13:59 +02:00
|
|
|
|
|
|
|
##
|
|
|
|
# @netdev_del:
|
|
|
|
#
|
|
|
|
# Remove a network backend.
|
|
|
|
#
|
|
|
|
# @id: the name of the network backend to remove
|
|
|
|
#
|
|
|
|
# Returns: Nothing on success
|
|
|
|
# If @id is not a valid network backend, DeviceNotFound
|
|
|
|
#
|
|
|
|
# Since: 0.14.0
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
#
|
|
|
|
# -> { "execute": "netdev_del", "arguments": { "id": "netdev1" } }
|
|
|
|
# <- { "return": {} }
|
|
|
|
#
|
|
|
|
##
|
|
|
|
{ 'command': 'netdev_del', 'data': {'id': 'str'} }
|
|
|
|
|
|
|
|
##
|
|
|
|
# @NetLegacyNicOptions:
|
|
|
|
#
|
|
|
|
# Create a new Network Interface Card.
|
|
|
|
#
|
|
|
|
# @netdev: id of -netdev to connect to
|
|
|
|
#
|
|
|
|
# @macaddr: MAC address
|
|
|
|
#
|
|
|
|
# @model: device model (e1000, rtl8139, virtio etc.)
|
|
|
|
#
|
|
|
|
# @addr: PCI device address
|
|
|
|
#
|
|
|
|
# @vectors: number of MSI-x vectors, 0 to disable MSI-X
|
|
|
|
#
|
|
|
|
# Since: 1.2
|
|
|
|
##
|
|
|
|
{ 'struct': 'NetLegacyNicOptions',
|
|
|
|
'data': {
|
|
|
|
'*netdev': 'str',
|
|
|
|
'*macaddr': 'str',
|
|
|
|
'*model': 'str',
|
|
|
|
'*addr': 'str',
|
|
|
|
'*vectors': 'uint32' } }
|
|
|
|
|
|
|
|
##
|
|
|
|
# @NetdevUserOptions:
|
|
|
|
#
|
|
|
|
# Use the user mode network stack which requires no administrator privilege to
|
|
|
|
# run.
|
|
|
|
#
|
|
|
|
# @hostname: client hostname reported by the builtin DHCP server
|
|
|
|
#
|
|
|
|
# @restrict: isolate the guest from the host
|
|
|
|
#
|
|
|
|
# @ipv4: whether to support IPv4, default true for enabled
|
|
|
|
# (since 2.6)
|
|
|
|
#
|
|
|
|
# @ipv6: whether to support IPv6, default true for enabled
|
|
|
|
# (since 2.6)
|
|
|
|
#
|
|
|
|
# @ip: legacy parameter, use net= instead
|
|
|
|
#
|
|
|
|
# @net: IP network address that the guest will see, in the
|
|
|
|
# form addr[/netmask] The netmask is optional, and can be
|
|
|
|
# either in the form a.b.c.d or as a number of valid top-most
|
|
|
|
# bits. Default is 10.0.2.0/24.
|
|
|
|
#
|
|
|
|
# @host: guest-visible address of the host
|
|
|
|
#
|
|
|
|
# @tftp: root directory of the built-in TFTP server
|
|
|
|
#
|
|
|
|
# @bootfile: BOOTP filename, for use with tftp=
|
|
|
|
#
|
|
|
|
# @dhcpstart: the first of the 16 IPs the built-in DHCP server can
|
|
|
|
# assign
|
|
|
|
#
|
|
|
|
# @dns: guest-visible address of the virtual nameserver
|
|
|
|
#
|
|
|
|
# @dnssearch: list of DNS suffixes to search, passed as DHCP option
|
|
|
|
# to the guest
|
|
|
|
#
|
2018-02-27 17:06:01 +01:00
|
|
|
# @domainname: guest-visible domain name of the virtual nameserver
|
2018-05-31 21:51:02 +02:00
|
|
|
# (since 3.0)
|
2018-02-27 17:06:01 +01:00
|
|
|
#
|
2017-08-24 21:13:59 +02:00
|
|
|
# @ipv6-prefix: IPv6 network prefix (default is fec0::) (since
|
|
|
|
# 2.6). The network prefix is given in the usual
|
|
|
|
# hexadecimal IPv6 address notation.
|
|
|
|
#
|
|
|
|
# @ipv6-prefixlen: IPv6 network prefix length (default is 64)
|
|
|
|
# (since 2.6)
|
|
|
|
#
|
|
|
|
# @ipv6-host: guest-visible IPv6 address of the host (since 2.6)
|
|
|
|
#
|
|
|
|
# @ipv6-dns: guest-visible IPv6 address of the virtual
|
|
|
|
# nameserver (since 2.6)
|
|
|
|
#
|
|
|
|
# @smb: root directory of the built-in SMB server
|
|
|
|
#
|
|
|
|
# @smbserver: IP address of the built-in SMB server
|
|
|
|
#
|
|
|
|
# @hostfwd: redirect incoming TCP or UDP host connections to guest
|
|
|
|
# endpoints
|
|
|
|
#
|
|
|
|
# @guestfwd: forward guest TCP connections
|
|
|
|
#
|
2018-09-14 09:26:16 +02:00
|
|
|
# @tftp-server-name: RFC2132 "TFTP server name" string (Since 3.1)
|
|
|
|
#
|
2017-08-24 21:13:59 +02:00
|
|
|
# Since: 1.2
|
|
|
|
##
|
|
|
|
{ 'struct': 'NetdevUserOptions',
|
|
|
|
'data': {
|
|
|
|
'*hostname': 'str',
|
|
|
|
'*restrict': 'bool',
|
|
|
|
'*ipv4': 'bool',
|
|
|
|
'*ipv6': 'bool',
|
|
|
|
'*ip': 'str',
|
|
|
|
'*net': 'str',
|
|
|
|
'*host': 'str',
|
|
|
|
'*tftp': 'str',
|
|
|
|
'*bootfile': 'str',
|
|
|
|
'*dhcpstart': 'str',
|
|
|
|
'*dns': 'str',
|
|
|
|
'*dnssearch': ['String'],
|
2018-02-27 17:06:01 +01:00
|
|
|
'*domainname': 'str',
|
2017-08-24 21:13:59 +02:00
|
|
|
'*ipv6-prefix': 'str',
|
|
|
|
'*ipv6-prefixlen': 'int',
|
|
|
|
'*ipv6-host': 'str',
|
|
|
|
'*ipv6-dns': 'str',
|
|
|
|
'*smb': 'str',
|
|
|
|
'*smbserver': 'str',
|
|
|
|
'*hostfwd': ['String'],
|
2018-09-14 09:26:16 +02:00
|
|
|
'*guestfwd': ['String'],
|
|
|
|
'*tftp-server-name': 'str' } }
|
2017-08-24 21:13:59 +02:00
|
|
|
|
|
|
|
##
|
|
|
|
# @NetdevTapOptions:
|
|
|
|
#
|
2018-04-30 20:02:23 +02:00
|
|
|
# Used to configure a host TAP network interface backend.
|
2017-08-24 21:13:59 +02:00
|
|
|
#
|
|
|
|
# @ifname: interface name
|
|
|
|
#
|
|
|
|
# @fd: file descriptor of an already opened tap
|
|
|
|
#
|
|
|
|
# @fds: multiple file descriptors of already opened multiqueue capable
|
2020-02-13 18:56:26 +01:00
|
|
|
# tap
|
2017-08-24 21:13:59 +02:00
|
|
|
#
|
|
|
|
# @script: script to initialize the interface
|
|
|
|
#
|
|
|
|
# @downscript: script to shut down the interface
|
|
|
|
#
|
|
|
|
# @br: bridge name (since 2.8)
|
|
|
|
#
|
|
|
|
# @helper: command to execute to configure bridge
|
|
|
|
#
|
|
|
|
# @sndbuf: send buffer limit. Understands [TGMKkb] suffixes.
|
|
|
|
#
|
|
|
|
# @vnet_hdr: enable the IFF_VNET_HDR flag on the tap interface
|
|
|
|
#
|
|
|
|
# @vhost: enable vhost-net network accelerator
|
|
|
|
#
|
|
|
|
# @vhostfd: file descriptor of an already opened vhost net device
|
|
|
|
#
|
|
|
|
# @vhostfds: file descriptors of multiple already opened vhost net
|
2020-02-13 18:56:26 +01:00
|
|
|
# devices
|
2017-08-24 21:13:59 +02:00
|
|
|
#
|
|
|
|
# @vhostforce: vhost on for non-MSIX virtio guests
|
|
|
|
#
|
|
|
|
# @queues: number of queues to be created for multiqueue capable tap
|
|
|
|
#
|
|
|
|
# @poll-us: maximum number of microseconds that could
|
2020-02-13 18:56:26 +01:00
|
|
|
# be spent on busy polling for tap (since 2.7)
|
2017-08-24 21:13:59 +02:00
|
|
|
#
|
|
|
|
# Since: 1.2
|
|
|
|
##
|
|
|
|
{ 'struct': 'NetdevTapOptions',
|
|
|
|
'data': {
|
|
|
|
'*ifname': 'str',
|
|
|
|
'*fd': 'str',
|
|
|
|
'*fds': 'str',
|
|
|
|
'*script': 'str',
|
|
|
|
'*downscript': 'str',
|
|
|
|
'*br': 'str',
|
|
|
|
'*helper': 'str',
|
|
|
|
'*sndbuf': 'size',
|
|
|
|
'*vnet_hdr': 'bool',
|
|
|
|
'*vhost': 'bool',
|
|
|
|
'*vhostfd': 'str',
|
|
|
|
'*vhostfds': 'str',
|
|
|
|
'*vhostforce': 'bool',
|
|
|
|
'*queues': 'uint32',
|
|
|
|
'*poll-us': 'uint32'} }
|
|
|
|
|
|
|
|
##
|
|
|
|
# @NetdevSocketOptions:
|
|
|
|
#
|
2018-04-30 20:02:23 +02:00
|
|
|
# Socket netdevs are used to establish a network connection to another
|
|
|
|
# QEMU virtual machine via a TCP socket.
|
2017-08-24 21:13:59 +02:00
|
|
|
#
|
|
|
|
# @fd: file descriptor of an already opened socket
|
|
|
|
#
|
|
|
|
# @listen: port number, and optional hostname, to listen on
|
|
|
|
#
|
|
|
|
# @connect: port number, and optional hostname, to connect to
|
|
|
|
#
|
|
|
|
# @mcast: UDP multicast address and port number
|
|
|
|
#
|
|
|
|
# @localaddr: source address and port for multicast and udp packets
|
|
|
|
#
|
|
|
|
# @udp: UDP unicast address and port number
|
|
|
|
#
|
|
|
|
# Since: 1.2
|
|
|
|
##
|
|
|
|
{ 'struct': 'NetdevSocketOptions',
|
|
|
|
'data': {
|
|
|
|
'*fd': 'str',
|
|
|
|
'*listen': 'str',
|
|
|
|
'*connect': 'str',
|
|
|
|
'*mcast': 'str',
|
|
|
|
'*localaddr': 'str',
|
|
|
|
'*udp': 'str' } }
|
|
|
|
|
|
|
|
##
|
|
|
|
# @NetdevL2TPv3Options:
|
|
|
|
#
|
2018-04-30 20:02:23 +02:00
|
|
|
# Configure an Ethernet over L2TPv3 tunnel.
|
2017-08-24 21:13:59 +02:00
|
|
|
#
|
|
|
|
# @src: source address
|
|
|
|
#
|
|
|
|
# @dst: destination address
|
|
|
|
#
|
|
|
|
# @srcport: source port - mandatory for udp, optional for ip
|
|
|
|
#
|
|
|
|
# @dstport: destination port - mandatory for udp, optional for ip
|
|
|
|
#
|
|
|
|
# @ipv6: force the use of ipv6
|
|
|
|
#
|
|
|
|
# @udp: use the udp version of l2tpv3 encapsulation
|
|
|
|
#
|
|
|
|
# @cookie64: use 64 bit coookies
|
|
|
|
#
|
|
|
|
# @counter: have sequence counter
|
|
|
|
#
|
|
|
|
# @pincounter: pin sequence counter to zero -
|
|
|
|
# workaround for buggy implementations or
|
|
|
|
# networks with packet reorder
|
|
|
|
#
|
|
|
|
# @txcookie: 32 or 64 bit transmit cookie
|
|
|
|
#
|
|
|
|
# @rxcookie: 32 or 64 bit receive cookie
|
|
|
|
#
|
|
|
|
# @txsession: 32 bit transmit session
|
|
|
|
#
|
|
|
|
# @rxsession: 32 bit receive session - if not specified
|
|
|
|
# set to the same value as transmit
|
|
|
|
#
|
|
|
|
# @offset: additional offset - allows the insertion of
|
|
|
|
# additional application-specific data before the packet payload
|
|
|
|
#
|
|
|
|
# Since: 2.1
|
|
|
|
##
|
|
|
|
{ 'struct': 'NetdevL2TPv3Options',
|
|
|
|
'data': {
|
|
|
|
'src': 'str',
|
|
|
|
'dst': 'str',
|
|
|
|
'*srcport': 'str',
|
|
|
|
'*dstport': 'str',
|
|
|
|
'*ipv6': 'bool',
|
|
|
|
'*udp': 'bool',
|
|
|
|
'*cookie64': 'bool',
|
|
|
|
'*counter': 'bool',
|
|
|
|
'*pincounter': 'bool',
|
|
|
|
'*txcookie': 'uint64',
|
|
|
|
'*rxcookie': 'uint64',
|
|
|
|
'txsession': 'uint32',
|
|
|
|
'*rxsession': 'uint32',
|
|
|
|
'*offset': 'uint32' } }
|
|
|
|
|
|
|
|
##
|
|
|
|
# @NetdevVdeOptions:
|
|
|
|
#
|
2018-04-30 20:02:23 +02:00
|
|
|
# Connect to a vde switch running on the host.
|
2017-08-24 21:13:59 +02:00
|
|
|
#
|
|
|
|
# @sock: socket path
|
|
|
|
#
|
|
|
|
# @port: port number
|
|
|
|
#
|
|
|
|
# @group: group owner of socket
|
|
|
|
#
|
|
|
|
# @mode: permissions for socket
|
|
|
|
#
|
|
|
|
# Since: 1.2
|
|
|
|
##
|
|
|
|
{ 'struct': 'NetdevVdeOptions',
|
|
|
|
'data': {
|
|
|
|
'*sock': 'str',
|
|
|
|
'*port': 'uint16',
|
|
|
|
'*group': 'str',
|
|
|
|
'*mode': 'uint16' } }
|
|
|
|
|
|
|
|
##
|
|
|
|
# @NetdevBridgeOptions:
|
|
|
|
#
|
|
|
|
# Connect a host TAP network interface to a host bridge device.
|
|
|
|
#
|
|
|
|
# @br: bridge name
|
|
|
|
#
|
|
|
|
# @helper: command to execute to configure bridge
|
|
|
|
#
|
|
|
|
# Since: 1.2
|
|
|
|
##
|
|
|
|
{ 'struct': 'NetdevBridgeOptions',
|
|
|
|
'data': {
|
|
|
|
'*br': 'str',
|
|
|
|
'*helper': 'str' } }
|
|
|
|
|
|
|
|
##
|
|
|
|
# @NetdevHubPortOptions:
|
|
|
|
#
|
|
|
|
# Connect two or more net clients through a software hub.
|
|
|
|
#
|
|
|
|
# @hubid: hub identifier number
|
net: Allow hubports to connect to other netdevs
QEMU can emulate hubs to connect NICs and netdevs. This is currently
primarily used for the mis-named 'vlan' feature of the networking
subsystem. Now the 'vlan' feature has been marked as deprecated, since
its name is rather confusing and the users often rather mis-configure
their network when trying to use it. But while the 'vlan' parameter
should be removed at one point in time, the basic idea of emulating
a hub in QEMU is still good: It's useful for bundling up the output of
multiple NICs into one single l2tp netdev for example.
Now to be able to use the hubport feature without 'vlan's, there is one
missing piece: The possibility to connect a hubport to a netdev, too.
This patch adds this possibility by introducing a new "netdev=..."
parameter to the hubports.
To bundle up the output of multiple NICs into one socket netdev, you can
now run QEMU with these parameters for example:
qemu-system-ppc64 ... -netdev socket,id=s1,connect=:11122 \
-netdev hubport,hubid=1,id=h1,netdev=s1 \
-netdev hubport,hubid=1,id=h2 -device e1000,netdev=h2 \
-netdev hubport,hubid=1,id=h3 -device virtio-net-pci,netdev=h3
For using the socket netdev, you have got to start another QEMU as the
receiving side first, for example with network dumping enabled:
qemu-system-x86_64 -M isapc -netdev socket,id=s0,listen=:11122 \
-device ne2k_isa,netdev=s0 \
-object filter-dump,id=f1,netdev=s0,file=/tmp/dump.dat
After the ppc64 guest tried to boot from both NICs, you can see in the
dump file (using Wireshark, for example), that the output of both NICs
(the e1000 and the virtio-net-pci) has been successfully transfered
via the socket netdev in this case.
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2018-01-15 20:50:55 +01:00
|
|
|
# @netdev: used to connect hub to a netdev instead of a device (since 2.12)
|
2017-08-24 21:13:59 +02:00
|
|
|
#
|
|
|
|
# Since: 1.2
|
|
|
|
##
|
|
|
|
{ 'struct': 'NetdevHubPortOptions',
|
|
|
|
'data': {
|
net: Allow hubports to connect to other netdevs
QEMU can emulate hubs to connect NICs and netdevs. This is currently
primarily used for the mis-named 'vlan' feature of the networking
subsystem. Now the 'vlan' feature has been marked as deprecated, since
its name is rather confusing and the users often rather mis-configure
their network when trying to use it. But while the 'vlan' parameter
should be removed at one point in time, the basic idea of emulating
a hub in QEMU is still good: It's useful for bundling up the output of
multiple NICs into one single l2tp netdev for example.
Now to be able to use the hubport feature without 'vlan's, there is one
missing piece: The possibility to connect a hubport to a netdev, too.
This patch adds this possibility by introducing a new "netdev=..."
parameter to the hubports.
To bundle up the output of multiple NICs into one socket netdev, you can
now run QEMU with these parameters for example:
qemu-system-ppc64 ... -netdev socket,id=s1,connect=:11122 \
-netdev hubport,hubid=1,id=h1,netdev=s1 \
-netdev hubport,hubid=1,id=h2 -device e1000,netdev=h2 \
-netdev hubport,hubid=1,id=h3 -device virtio-net-pci,netdev=h3
For using the socket netdev, you have got to start another QEMU as the
receiving side first, for example with network dumping enabled:
qemu-system-x86_64 -M isapc -netdev socket,id=s0,listen=:11122 \
-device ne2k_isa,netdev=s0 \
-object filter-dump,id=f1,netdev=s0,file=/tmp/dump.dat
After the ppc64 guest tried to boot from both NICs, you can see in the
dump file (using Wireshark, for example), that the output of both NICs
(the e1000 and the virtio-net-pci) has been successfully transfered
via the socket netdev in this case.
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2018-01-15 20:50:55 +01:00
|
|
|
'hubid': 'int32',
|
|
|
|
'*netdev': 'str' } }
|
2017-08-24 21:13:59 +02:00
|
|
|
|
|
|
|
##
|
|
|
|
# @NetdevNetmapOptions:
|
|
|
|
#
|
|
|
|
# Connect a client to a netmap-enabled NIC or to a VALE switch port
|
|
|
|
#
|
|
|
|
# @ifname: Either the name of an existing network interface supported by
|
|
|
|
# netmap, or the name of a VALE port (created on the fly).
|
|
|
|
# A VALE port name is in the form 'valeXXX:YYY', where XXX and
|
|
|
|
# YYY are non-negative integers. XXX identifies a switch and
|
|
|
|
# YYY identifies a port of the switch. VALE ports having the
|
|
|
|
# same XXX are therefore connected to the same switch.
|
|
|
|
#
|
|
|
|
# @devname: path of the netmap device (default: '/dev/netmap').
|
|
|
|
#
|
|
|
|
# Since: 2.0
|
|
|
|
##
|
|
|
|
{ 'struct': 'NetdevNetmapOptions',
|
|
|
|
'data': {
|
|
|
|
'ifname': 'str',
|
|
|
|
'*devname': 'str' } }
|
|
|
|
|
|
|
|
##
|
|
|
|
# @NetdevVhostUserOptions:
|
|
|
|
#
|
|
|
|
# Vhost-user network backend
|
|
|
|
#
|
|
|
|
# @chardev: name of a unix socket chardev
|
|
|
|
#
|
|
|
|
# @vhostforce: vhost on for non-MSIX virtio guests (default: false).
|
|
|
|
#
|
|
|
|
# @queues: number of queues to be created for multiqueue vhost-user
|
|
|
|
# (default: 1) (Since 2.5)
|
|
|
|
#
|
|
|
|
# Since: 2.1
|
|
|
|
##
|
|
|
|
{ 'struct': 'NetdevVhostUserOptions',
|
|
|
|
'data': {
|
|
|
|
'chardev': 'str',
|
|
|
|
'*vhostforce': 'bool',
|
|
|
|
'*queues': 'int' } }
|
|
|
|
|
2020-07-01 16:55:38 +02:00
|
|
|
##
|
|
|
|
# @NetdevVhostVDPAOptions:
|
|
|
|
#
|
|
|
|
# Vhost-vdpa network backend
|
|
|
|
#
|
|
|
|
# vDPA device is a device that uses a datapath which complies with the virtio
|
|
|
|
# specifications with a vendor specific control path.
|
|
|
|
#
|
|
|
|
# @vhostdev: path of vhost-vdpa device
|
|
|
|
# (default:'/dev/vhost-vdpa-0')
|
|
|
|
#
|
|
|
|
# @queues: number of queues to be created for multiqueue vhost-vdpa
|
|
|
|
# (default: 1)
|
|
|
|
#
|
|
|
|
# Since: 5.1
|
|
|
|
##
|
|
|
|
{ 'struct': 'NetdevVhostVDPAOptions',
|
|
|
|
'data': {
|
|
|
|
'*vhostdev': 'str',
|
|
|
|
'*queues': 'int' } }
|
|
|
|
|
2017-08-24 21:13:59 +02:00
|
|
|
##
|
|
|
|
# @NetClientDriver:
|
|
|
|
#
|
|
|
|
# Available netdev drivers.
|
|
|
|
#
|
|
|
|
# Since: 2.7
|
2020-07-01 16:55:38 +02:00
|
|
|
#
|
2020-08-10 21:50:01 +02:00
|
|
|
# @vhost-vdpa since 5.1
|
2017-08-24 21:13:59 +02:00
|
|
|
##
|
|
|
|
{ 'enum': 'NetClientDriver',
|
2018-02-21 11:18:34 +01:00
|
|
|
'data': [ 'none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde',
|
2020-07-01 16:55:38 +02:00
|
|
|
'bridge', 'hubport', 'netmap', 'vhost-user', 'vhost-vdpa' ] }
|
2017-08-24 21:13:59 +02:00
|
|
|
|
|
|
|
##
|
|
|
|
# @Netdev:
|
|
|
|
#
|
|
|
|
# Captures the configuration of a network device.
|
|
|
|
#
|
|
|
|
# @id: identifier for monitor commands.
|
|
|
|
#
|
|
|
|
# @type: Specify the driver used for interpreting remaining arguments.
|
|
|
|
#
|
|
|
|
# Since: 1.2
|
|
|
|
#
|
2020-02-13 18:56:26 +01:00
|
|
|
# 'l2tpv3' - since 2.1
|
2017-08-24 21:13:59 +02:00
|
|
|
##
|
|
|
|
{ 'union': 'Netdev',
|
|
|
|
'base': { 'id': 'str', 'type': 'NetClientDriver' },
|
|
|
|
'discriminator': 'type',
|
|
|
|
'data': {
|
|
|
|
'nic': 'NetLegacyNicOptions',
|
|
|
|
'user': 'NetdevUserOptions',
|
|
|
|
'tap': 'NetdevTapOptions',
|
|
|
|
'l2tpv3': 'NetdevL2TPv3Options',
|
|
|
|
'socket': 'NetdevSocketOptions',
|
|
|
|
'vde': 'NetdevVdeOptions',
|
|
|
|
'bridge': 'NetdevBridgeOptions',
|
|
|
|
'hubport': 'NetdevHubPortOptions',
|
|
|
|
'netmap': 'NetdevNetmapOptions',
|
2020-07-01 16:55:38 +02:00
|
|
|
'vhost-user': 'NetdevVhostUserOptions',
|
|
|
|
'vhost-vdpa': 'NetdevVhostVDPAOptions' } }
|
2017-08-24 21:13:59 +02:00
|
|
|
|
|
|
|
##
|
|
|
|
# @NetFilterDirection:
|
|
|
|
#
|
|
|
|
# Indicates whether a netfilter is attached to a netdev's transmit queue or
|
|
|
|
# receive queue or both.
|
|
|
|
#
|
|
|
|
# @all: the filter is attached both to the receive and the transmit
|
|
|
|
# queue of the netdev (default).
|
|
|
|
#
|
|
|
|
# @rx: the filter is attached to the receive queue of the netdev,
|
|
|
|
# where it will receive packets sent to the netdev.
|
|
|
|
#
|
|
|
|
# @tx: the filter is attached to the transmit queue of the netdev,
|
|
|
|
# where it will receive packets sent by the netdev.
|
|
|
|
#
|
|
|
|
# Since: 2.5
|
|
|
|
##
|
|
|
|
{ 'enum': 'NetFilterDirection',
|
|
|
|
'data': [ 'all', 'rx', 'tx' ] }
|
|
|
|
|
|
|
|
##
|
|
|
|
# @RxState:
|
|
|
|
#
|
|
|
|
# Packets receiving state
|
|
|
|
#
|
|
|
|
# @normal: filter assigned packets according to the mac-table
|
|
|
|
#
|
|
|
|
# @none: don't receive any assigned packet
|
|
|
|
#
|
|
|
|
# @all: receive all assigned packets
|
|
|
|
#
|
|
|
|
# Since: 1.6
|
|
|
|
##
|
|
|
|
{ 'enum': 'RxState', 'data': [ 'normal', 'none', 'all' ] }
|
|
|
|
|
|
|
|
##
|
|
|
|
# @RxFilterInfo:
|
|
|
|
#
|
|
|
|
# Rx-filter information for a NIC.
|
|
|
|
#
|
|
|
|
# @name: net client name
|
|
|
|
#
|
|
|
|
# @promiscuous: whether promiscuous mode is enabled
|
|
|
|
#
|
|
|
|
# @multicast: multicast receive state
|
|
|
|
#
|
|
|
|
# @unicast: unicast receive state
|
|
|
|
#
|
|
|
|
# @vlan: vlan receive state (Since 2.0)
|
|
|
|
#
|
|
|
|
# @broadcast-allowed: whether to receive broadcast
|
|
|
|
#
|
|
|
|
# @multicast-overflow: multicast table is overflowed or not
|
|
|
|
#
|
|
|
|
# @unicast-overflow: unicast table is overflowed or not
|
|
|
|
#
|
|
|
|
# @main-mac: the main macaddr string
|
|
|
|
#
|
|
|
|
# @vlan-table: a list of active vlan id
|
|
|
|
#
|
|
|
|
# @unicast-table: a list of unicast macaddr string
|
|
|
|
#
|
|
|
|
# @multicast-table: a list of multicast macaddr string
|
|
|
|
#
|
|
|
|
# Since: 1.6
|
|
|
|
##
|
|
|
|
{ 'struct': 'RxFilterInfo',
|
|
|
|
'data': {
|
|
|
|
'name': 'str',
|
|
|
|
'promiscuous': 'bool',
|
|
|
|
'multicast': 'RxState',
|
|
|
|
'unicast': 'RxState',
|
|
|
|
'vlan': 'RxState',
|
|
|
|
'broadcast-allowed': 'bool',
|
|
|
|
'multicast-overflow': 'bool',
|
|
|
|
'unicast-overflow': 'bool',
|
|
|
|
'main-mac': 'str',
|
|
|
|
'vlan-table': ['int'],
|
|
|
|
'unicast-table': ['str'],
|
|
|
|
'multicast-table': ['str'] }}
|
|
|
|
|
|
|
|
##
|
|
|
|
# @query-rx-filter:
|
|
|
|
#
|
|
|
|
# Return rx-filter information for all NICs (or for the given NIC).
|
|
|
|
#
|
|
|
|
# @name: net client name
|
|
|
|
#
|
|
|
|
# Returns: list of @RxFilterInfo for all NICs (or for the given NIC).
|
|
|
|
# Returns an error if the given @name doesn't exist, or given
|
|
|
|
# NIC doesn't support rx-filter querying, or given net client
|
|
|
|
# isn't a NIC.
|
|
|
|
#
|
|
|
|
# Since: 1.6
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
#
|
|
|
|
# -> { "execute": "query-rx-filter", "arguments": { "name": "vnet0" } }
|
|
|
|
# <- { "return": [
|
|
|
|
# {
|
|
|
|
# "promiscuous": true,
|
|
|
|
# "name": "vnet0",
|
|
|
|
# "main-mac": "52:54:00:12:34:56",
|
|
|
|
# "unicast": "normal",
|
|
|
|
# "vlan": "normal",
|
|
|
|
# "vlan-table": [
|
|
|
|
# 4,
|
|
|
|
# 0
|
|
|
|
# ],
|
|
|
|
# "unicast-table": [
|
|
|
|
# ],
|
|
|
|
# "multicast": "normal",
|
|
|
|
# "multicast-overflow": false,
|
|
|
|
# "unicast-overflow": false,
|
|
|
|
# "multicast-table": [
|
|
|
|
# "01:00:5e:00:00:01",
|
|
|
|
# "33:33:00:00:00:01",
|
|
|
|
# "33:33:ff:12:34:56"
|
|
|
|
# ],
|
|
|
|
# "broadcast-allowed": false
|
|
|
|
# }
|
|
|
|
# ]
|
|
|
|
# }
|
|
|
|
#
|
|
|
|
##
|
2018-12-08 12:16:04 +01:00
|
|
|
{ 'command': 'query-rx-filter',
|
|
|
|
'data': { '*name': 'str' },
|
2017-08-24 21:13:59 +02:00
|
|
|
'returns': ['RxFilterInfo'] }
|
|
|
|
|
|
|
|
##
|
|
|
|
# @NIC_RX_FILTER_CHANGED:
|
|
|
|
#
|
|
|
|
# Emitted once until the 'query-rx-filter' command is executed, the first event
|
|
|
|
# will always be emitted
|
|
|
|
#
|
|
|
|
# @name: net client name
|
|
|
|
#
|
|
|
|
# @path: device path
|
|
|
|
#
|
|
|
|
# Since: 1.6
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
#
|
|
|
|
# <- { "event": "NIC_RX_FILTER_CHANGED",
|
|
|
|
# "data": { "name": "vnet0",
|
|
|
|
# "path": "/machine/peripheral/vnet0/virtio-backend" },
|
|
|
|
# "timestamp": { "seconds": 1368697518, "microseconds": 326866 } }
|
|
|
|
# }
|
|
|
|
#
|
|
|
|
##
|
|
|
|
{ 'event': 'NIC_RX_FILTER_CHANGED',
|
|
|
|
'data': { '*name': 'str', 'path': 'str' } }
|
2019-02-27 14:24:05 +01:00
|
|
|
|
|
|
|
##
|
|
|
|
# @AnnounceParameters:
|
|
|
|
#
|
|
|
|
# Parameters for self-announce timers
|
|
|
|
#
|
|
|
|
# @initial: Initial delay (in ms) before sending the first GARP/RARP
|
2020-02-13 18:56:26 +01:00
|
|
|
# announcement
|
2019-02-27 14:24:05 +01:00
|
|
|
#
|
|
|
|
# @max: Maximum delay (in ms) between GARP/RARP announcement packets
|
|
|
|
#
|
|
|
|
# @rounds: Number of self-announcement attempts
|
|
|
|
#
|
|
|
|
# @step: Delay increase (in ms) after each self-announcement attempt
|
|
|
|
#
|
2019-06-20 20:47:02 +02:00
|
|
|
# @interfaces: An optional list of interface names, which restricts the
|
2020-02-13 18:56:26 +01:00
|
|
|
# announcement to the listed interfaces. (Since 4.1)
|
2019-06-20 20:47:02 +02:00
|
|
|
#
|
2019-06-20 20:47:04 +02:00
|
|
|
# @id: A name to be used to identify an instance of announce-timers
|
2020-02-13 18:56:26 +01:00
|
|
|
# and to allow it to modified later. Not for use as
|
|
|
|
# part of the migration parameters. (Since 4.1)
|
2019-06-20 20:47:04 +02:00
|
|
|
#
|
2019-02-27 14:24:05 +01:00
|
|
|
# Since: 4.0
|
|
|
|
##
|
|
|
|
|
|
|
|
{ 'struct': 'AnnounceParameters',
|
|
|
|
'data': { 'initial': 'int',
|
|
|
|
'max': 'int',
|
|
|
|
'rounds': 'int',
|
2019-06-20 20:47:02 +02:00
|
|
|
'step': 'int',
|
2019-06-20 20:47:04 +02:00
|
|
|
'*interfaces': ['str'],
|
|
|
|
'*id' : 'str' } }
|
2019-02-27 14:24:11 +01:00
|
|
|
|
|
|
|
##
|
|
|
|
# @announce-self:
|
|
|
|
#
|
|
|
|
# Trigger generation of broadcast RARP frames to update network switches.
|
|
|
|
# This can be useful when network bonds fail-over the active slave.
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
#
|
2019-06-20 20:47:02 +02:00
|
|
|
# -> { "execute": "announce-self",
|
2019-02-27 14:24:11 +01:00
|
|
|
# "arguments": {
|
2019-06-20 20:47:02 +02:00
|
|
|
# "initial": 50, "max": 550, "rounds": 10, "step": 50,
|
2019-06-20 20:47:04 +02:00
|
|
|
# "interfaces": ["vn2", "vn3"], "id": "bob" } }
|
2019-02-27 14:24:11 +01:00
|
|
|
# <- { "return": {} }
|
|
|
|
#
|
|
|
|
# Since: 4.0
|
|
|
|
##
|
|
|
|
{ 'command': 'announce-self', 'boxed': true,
|
|
|
|
'data' : 'AnnounceParameters'}
|
2019-10-29 12:49:00 +01:00
|
|
|
|
|
|
|
##
|
|
|
|
# @FAILOVER_NEGOTIATED:
|
|
|
|
#
|
|
|
|
# Emitted when VIRTIO_NET_F_STANDBY was enabled during feature negotiation.
|
|
|
|
# Failover primary devices which were hidden (not hotplugged when requested)
|
|
|
|
# before will now be hotplugged by the virtio-net standby device.
|
|
|
|
#
|
|
|
|
# device-id: QEMU device id of the unplugged device
|
|
|
|
# Since: 4.2
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
#
|
|
|
|
# <- { "event": "FAILOVER_NEGOTIATED",
|
|
|
|
# "data": "net1" }
|
|
|
|
#
|
|
|
|
##
|
|
|
|
{ 'event': 'FAILOVER_NEGOTIATED',
|
|
|
|
'data': {'device-id': 'str'} }
|