1# -*- Mode: Python -*- 2# 3 4## 5# = Net devices 6## 7 8{ 'include': 'common.json' } 9 10## 11# @set_link: 12# 13# Sets the link status of a virtual network adapter. 14# 15# @name: the device name of the virtual network adapter 16# 17# @up: true to set the link status to be up 18# 19# Returns: Nothing on success 20# If @name is not a valid network device, DeviceNotFound 21# 22# Since: 0.14.0 23# 24# Notes: Not all network adapters support setting link status. This command 25# will succeed even if the network adapter does not support link status 26# notification. 27# 28# Example: 29# 30# -> { "execute": "set_link", 31# "arguments": { "name": "e1000.0", "up": false } } 32# <- { "return": {} } 33# 34## 35{ 'command': 'set_link', 'data': {'name': 'str', 'up': 'bool'} } 36 37## 38# @netdev_add: 39# 40# Add a network backend. 41# 42# @type: the type of network backend. Possible values are listed in 43# NetClientDriver (excluding 'none' and 'nic') 44# 45# @id: the name of the new network backend 46# 47# Additional arguments depend on the type. 48# 49# TODO: This command effectively bypasses QAPI completely due to its 50# "additional arguments" business. It shouldn't have been added to 51# the schema in this form. It should be qapified properly, or 52# replaced by a properly qapified command. 53# 54# Since: 0.14.0 55# 56# Returns: Nothing on success 57# If @type is not a valid network backend, DeviceNotFound 58# 59# Example: 60# 61# -> { "execute": "netdev_add", 62# "arguments": { "type": "user", "id": "netdev1", 63# "dnssearch": "example.org" } } 64# <- { "return": {} } 65# 66## 67{ 'command': 'netdev_add', 68 'data': {'type': 'str', 'id': 'str'}, 69 'gen': false } # so we can get the additional arguments 70 71## 72# @netdev_del: 73# 74# Remove a network backend. 75# 76# @id: the name of the network backend to remove 77# 78# Returns: Nothing on success 79# If @id is not a valid network backend, DeviceNotFound 80# 81# Since: 0.14.0 82# 83# Example: 84# 85# -> { "execute": "netdev_del", "arguments": { "id": "netdev1" } } 86# <- { "return": {} } 87# 88## 89{ 'command': 'netdev_del', 'data': {'id': 'str'} } 90 91## 92# @NetdevNoneOptions: 93# 94# Use it alone to have zero network devices. 95# 96# Since: 1.2 97## 98{ 'struct': 'NetdevNoneOptions', 99 'data': { } } 100 101## 102# @NetLegacyNicOptions: 103# 104# Create a new Network Interface Card. 105# 106# @netdev: id of -netdev to connect to 107# 108# @macaddr: MAC address 109# 110# @model: device model (e1000, rtl8139, virtio etc.) 111# 112# @addr: PCI device address 113# 114# @vectors: number of MSI-x vectors, 0 to disable MSI-X 115# 116# Since: 1.2 117## 118{ 'struct': 'NetLegacyNicOptions', 119 'data': { 120 '*netdev': 'str', 121 '*macaddr': 'str', 122 '*model': 'str', 123 '*addr': 'str', 124 '*vectors': 'uint32' } } 125 126## 127# @NetdevUserOptions: 128# 129# Use the user mode network stack which requires no administrator privilege to 130# run. 131# 132# @hostname: client hostname reported by the builtin DHCP server 133# 134# @restrict: isolate the guest from the host 135# 136# @ipv4: whether to support IPv4, default true for enabled 137# (since 2.6) 138# 139# @ipv6: whether to support IPv6, default true for enabled 140# (since 2.6) 141# 142# @ip: legacy parameter, use net= instead 143# 144# @net: IP network address that the guest will see, in the 145# form addr[/netmask] The netmask is optional, and can be 146# either in the form a.b.c.d or as a number of valid top-most 147# bits. Default is 10.0.2.0/24. 148# 149# @host: guest-visible address of the host 150# 151# @tftp: root directory of the built-in TFTP server 152# 153# @bootfile: BOOTP filename, for use with tftp= 154# 155# @dhcpstart: the first of the 16 IPs the built-in DHCP server can 156# assign 157# 158# @dns: guest-visible address of the virtual nameserver 159# 160# @dnssearch: list of DNS suffixes to search, passed as DHCP option 161# to the guest 162# 163# @domainname: guest-visible domain name of the virtual nameserver 164# (since 3.0) 165# 166# @ipv6-prefix: IPv6 network prefix (default is fec0::) (since 167# 2.6). The network prefix is given in the usual 168# hexadecimal IPv6 address notation. 169# 170# @ipv6-prefixlen: IPv6 network prefix length (default is 64) 171# (since 2.6) 172# 173# @ipv6-host: guest-visible IPv6 address of the host (since 2.6) 174# 175# @ipv6-dns: guest-visible IPv6 address of the virtual 176# nameserver (since 2.6) 177# 178# @smb: root directory of the built-in SMB server 179# 180# @smbserver: IP address of the built-in SMB server 181# 182# @hostfwd: redirect incoming TCP or UDP host connections to guest 183# endpoints 184# 185# @guestfwd: forward guest TCP connections 186# 187# Since: 1.2 188## 189{ 'struct': 'NetdevUserOptions', 190 'data': { 191 '*hostname': 'str', 192 '*restrict': 'bool', 193 '*ipv4': 'bool', 194 '*ipv6': 'bool', 195 '*ip': 'str', 196 '*net': 'str', 197 '*host': 'str', 198 '*tftp': 'str', 199 '*bootfile': 'str', 200 '*dhcpstart': 'str', 201 '*dns': 'str', 202 '*dnssearch': ['String'], 203 '*domainname': 'str', 204 '*ipv6-prefix': 'str', 205 '*ipv6-prefixlen': 'int', 206 '*ipv6-host': 'str', 207 '*ipv6-dns': 'str', 208 '*smb': 'str', 209 '*smbserver': 'str', 210 '*hostfwd': ['String'], 211 '*guestfwd': ['String'] } } 212 213## 214# @NetdevTapOptions: 215# 216# Used to configure a host TAP network interface backend. 217# 218# @ifname: interface name 219# 220# @fd: file descriptor of an already opened tap 221# 222# @fds: multiple file descriptors of already opened multiqueue capable 223# tap 224# 225# @script: script to initialize the interface 226# 227# @downscript: script to shut down the interface 228# 229# @br: bridge name (since 2.8) 230# 231# @helper: command to execute to configure bridge 232# 233# @sndbuf: send buffer limit. Understands [TGMKkb] suffixes. 234# 235# @vnet_hdr: enable the IFF_VNET_HDR flag on the tap interface 236# 237# @vhost: enable vhost-net network accelerator 238# 239# @vhostfd: file descriptor of an already opened vhost net device 240# 241# @vhostfds: file descriptors of multiple already opened vhost net 242# devices 243# 244# @vhostforce: vhost on for non-MSIX virtio guests 245# 246# @queues: number of queues to be created for multiqueue capable tap 247# 248# @poll-us: maximum number of microseconds that could 249# be spent on busy polling for tap (since 2.7) 250# 251# Since: 1.2 252## 253{ 'struct': 'NetdevTapOptions', 254 'data': { 255 '*ifname': 'str', 256 '*fd': 'str', 257 '*fds': 'str', 258 '*script': 'str', 259 '*downscript': 'str', 260 '*br': 'str', 261 '*helper': 'str', 262 '*sndbuf': 'size', 263 '*vnet_hdr': 'bool', 264 '*vhost': 'bool', 265 '*vhostfd': 'str', 266 '*vhostfds': 'str', 267 '*vhostforce': 'bool', 268 '*queues': 'uint32', 269 '*poll-us': 'uint32'} } 270 271## 272# @NetdevSocketOptions: 273# 274# Socket netdevs are used to establish a network connection to another 275# QEMU virtual machine via a TCP socket. 276# 277# @fd: file descriptor of an already opened socket 278# 279# @listen: port number, and optional hostname, to listen on 280# 281# @connect: port number, and optional hostname, to connect to 282# 283# @mcast: UDP multicast address and port number 284# 285# @localaddr: source address and port for multicast and udp packets 286# 287# @udp: UDP unicast address and port number 288# 289# Since: 1.2 290## 291{ 'struct': 'NetdevSocketOptions', 292 'data': { 293 '*fd': 'str', 294 '*listen': 'str', 295 '*connect': 'str', 296 '*mcast': 'str', 297 '*localaddr': 'str', 298 '*udp': 'str' } } 299 300## 301# @NetdevL2TPv3Options: 302# 303# Configure an Ethernet over L2TPv3 tunnel. 304# 305# @src: source address 306# 307# @dst: destination address 308# 309# @srcport: source port - mandatory for udp, optional for ip 310# 311# @dstport: destination port - mandatory for udp, optional for ip 312# 313# @ipv6: force the use of ipv6 314# 315# @udp: use the udp version of l2tpv3 encapsulation 316# 317# @cookie64: use 64 bit coookies 318# 319# @counter: have sequence counter 320# 321# @pincounter: pin sequence counter to zero - 322# workaround for buggy implementations or 323# networks with packet reorder 324# 325# @txcookie: 32 or 64 bit transmit cookie 326# 327# @rxcookie: 32 or 64 bit receive cookie 328# 329# @txsession: 32 bit transmit session 330# 331# @rxsession: 32 bit receive session - if not specified 332# set to the same value as transmit 333# 334# @offset: additional offset - allows the insertion of 335# additional application-specific data before the packet payload 336# 337# Since: 2.1 338## 339{ 'struct': 'NetdevL2TPv3Options', 340 'data': { 341 'src': 'str', 342 'dst': 'str', 343 '*srcport': 'str', 344 '*dstport': 'str', 345 '*ipv6': 'bool', 346 '*udp': 'bool', 347 '*cookie64': 'bool', 348 '*counter': 'bool', 349 '*pincounter': 'bool', 350 '*txcookie': 'uint64', 351 '*rxcookie': 'uint64', 352 'txsession': 'uint32', 353 '*rxsession': 'uint32', 354 '*offset': 'uint32' } } 355 356## 357# @NetdevVdeOptions: 358# 359# Connect to a vde switch running on the host. 360# 361# @sock: socket path 362# 363# @port: port number 364# 365# @group: group owner of socket 366# 367# @mode: permissions for socket 368# 369# Since: 1.2 370## 371{ 'struct': 'NetdevVdeOptions', 372 'data': { 373 '*sock': 'str', 374 '*port': 'uint16', 375 '*group': 'str', 376 '*mode': 'uint16' } } 377 378## 379# @NetdevBridgeOptions: 380# 381# Connect a host TAP network interface to a host bridge device. 382# 383# @br: bridge name 384# 385# @helper: command to execute to configure bridge 386# 387# Since: 1.2 388## 389{ 'struct': 'NetdevBridgeOptions', 390 'data': { 391 '*br': 'str', 392 '*helper': 'str' } } 393 394## 395# @NetdevHubPortOptions: 396# 397# Connect two or more net clients through a software hub. 398# 399# @hubid: hub identifier number 400# @netdev: used to connect hub to a netdev instead of a device (since 2.12) 401# 402# Since: 1.2 403## 404{ 'struct': 'NetdevHubPortOptions', 405 'data': { 406 'hubid': 'int32', 407 '*netdev': 'str' } } 408 409## 410# @NetdevNetmapOptions: 411# 412# Connect a client to a netmap-enabled NIC or to a VALE switch port 413# 414# @ifname: Either the name of an existing network interface supported by 415# netmap, or the name of a VALE port (created on the fly). 416# A VALE port name is in the form 'valeXXX:YYY', where XXX and 417# YYY are non-negative integers. XXX identifies a switch and 418# YYY identifies a port of the switch. VALE ports having the 419# same XXX are therefore connected to the same switch. 420# 421# @devname: path of the netmap device (default: '/dev/netmap'). 422# 423# Since: 2.0 424## 425{ 'struct': 'NetdevNetmapOptions', 426 'data': { 427 'ifname': 'str', 428 '*devname': 'str' } } 429 430## 431# @NetdevVhostUserOptions: 432# 433# Vhost-user network backend 434# 435# @chardev: name of a unix socket chardev 436# 437# @vhostforce: vhost on for non-MSIX virtio guests (default: false). 438# 439# @queues: number of queues to be created for multiqueue vhost-user 440# (default: 1) (Since 2.5) 441# 442# Since: 2.1 443## 444{ 'struct': 'NetdevVhostUserOptions', 445 'data': { 446 'chardev': 'str', 447 '*vhostforce': 'bool', 448 '*queues': 'int' } } 449 450## 451# @NetClientDriver: 452# 453# Available netdev drivers. 454# 455# Since: 2.7 456# 457# 'dump': dropped in 2.12 458## 459{ 'enum': 'NetClientDriver', 460 'data': [ 'none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde', 461 'bridge', 'hubport', 'netmap', 'vhost-user' ] } 462 463## 464# @Netdev: 465# 466# Captures the configuration of a network device. 467# 468# @id: identifier for monitor commands. 469# 470# @type: Specify the driver used for interpreting remaining arguments. 471# 472# Since: 1.2 473# 474# 'l2tpv3' - since 2.1 475## 476{ 'union': 'Netdev', 477 'base': { 'id': 'str', 'type': 'NetClientDriver' }, 478 'discriminator': 'type', 479 'data': { 480 'none': 'NetdevNoneOptions', 481 'nic': 'NetLegacyNicOptions', 482 'user': 'NetdevUserOptions', 483 'tap': 'NetdevTapOptions', 484 'l2tpv3': 'NetdevL2TPv3Options', 485 'socket': 'NetdevSocketOptions', 486 'vde': 'NetdevVdeOptions', 487 'bridge': 'NetdevBridgeOptions', 488 'hubport': 'NetdevHubPortOptions', 489 'netmap': 'NetdevNetmapOptions', 490 'vhost-user': 'NetdevVhostUserOptions' } } 491 492## 493# @NetLegacy: 494# 495# Captures the configuration of a network device; legacy. 496# 497# @id: identifier for monitor commands 498# 499# @name: identifier for monitor commands, ignored if @id is present 500# 501# @opts: device type specific properties (legacy) 502# 503# Since: 1.2 504# 505# 'vlan': dropped in 3.0 506## 507{ 'struct': 'NetLegacy', 508 'data': { 509 '*id': 'str', 510 '*name': 'str', 511 'opts': 'NetLegacyOptions' } } 512 513## 514# @NetLegacyOptionsType: 515# 516# Since: 1.2 517## 518{ 'enum': 'NetLegacyOptionsType', 519 'data': ['none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde', 520 'bridge', 'netmap', 'vhost-user'] } 521 522## 523# @NetLegacyOptions: 524# 525# Like Netdev, but for use only by the legacy command line options 526# 527# Since: 1.2 528## 529{ 'union': 'NetLegacyOptions', 530 'base': { 'type': 'NetLegacyOptionsType' }, 531 'discriminator': 'type', 532 'data': { 533 'none': 'NetdevNoneOptions', 534 'nic': 'NetLegacyNicOptions', 535 'user': 'NetdevUserOptions', 536 'tap': 'NetdevTapOptions', 537 'l2tpv3': 'NetdevL2TPv3Options', 538 'socket': 'NetdevSocketOptions', 539 'vde': 'NetdevVdeOptions', 540 'bridge': 'NetdevBridgeOptions', 541 'netmap': 'NetdevNetmapOptions', 542 'vhost-user': 'NetdevVhostUserOptions' } } 543 544## 545# @NetFilterDirection: 546# 547# Indicates whether a netfilter is attached to a netdev's transmit queue or 548# receive queue or both. 549# 550# @all: the filter is attached both to the receive and the transmit 551# queue of the netdev (default). 552# 553# @rx: the filter is attached to the receive queue of the netdev, 554# where it will receive packets sent to the netdev. 555# 556# @tx: the filter is attached to the transmit queue of the netdev, 557# where it will receive packets sent by the netdev. 558# 559# Since: 2.5 560## 561{ 'enum': 'NetFilterDirection', 562 'data': [ 'all', 'rx', 'tx' ] } 563 564## 565# @RxState: 566# 567# Packets receiving state 568# 569# @normal: filter assigned packets according to the mac-table 570# 571# @none: don't receive any assigned packet 572# 573# @all: receive all assigned packets 574# 575# Since: 1.6 576## 577{ 'enum': 'RxState', 'data': [ 'normal', 'none', 'all' ] } 578 579## 580# @RxFilterInfo: 581# 582# Rx-filter information for a NIC. 583# 584# @name: net client name 585# 586# @promiscuous: whether promiscuous mode is enabled 587# 588# @multicast: multicast receive state 589# 590# @unicast: unicast receive state 591# 592# @vlan: vlan receive state (Since 2.0) 593# 594# @broadcast-allowed: whether to receive broadcast 595# 596# @multicast-overflow: multicast table is overflowed or not 597# 598# @unicast-overflow: unicast table is overflowed or not 599# 600# @main-mac: the main macaddr string 601# 602# @vlan-table: a list of active vlan id 603# 604# @unicast-table: a list of unicast macaddr string 605# 606# @multicast-table: a list of multicast macaddr string 607# 608# Since: 1.6 609## 610{ 'struct': 'RxFilterInfo', 611 'data': { 612 'name': 'str', 613 'promiscuous': 'bool', 614 'multicast': 'RxState', 615 'unicast': 'RxState', 616 'vlan': 'RxState', 617 'broadcast-allowed': 'bool', 618 'multicast-overflow': 'bool', 619 'unicast-overflow': 'bool', 620 'main-mac': 'str', 621 'vlan-table': ['int'], 622 'unicast-table': ['str'], 623 'multicast-table': ['str'] }} 624 625## 626# @query-rx-filter: 627# 628# Return rx-filter information for all NICs (or for the given NIC). 629# 630# @name: net client name 631# 632# Returns: list of @RxFilterInfo for all NICs (or for the given NIC). 633# Returns an error if the given @name doesn't exist, or given 634# NIC doesn't support rx-filter querying, or given net client 635# isn't a NIC. 636# 637# Since: 1.6 638# 639# Example: 640# 641# -> { "execute": "query-rx-filter", "arguments": { "name": "vnet0" } } 642# <- { "return": [ 643# { 644# "promiscuous": true, 645# "name": "vnet0", 646# "main-mac": "52:54:00:12:34:56", 647# "unicast": "normal", 648# "vlan": "normal", 649# "vlan-table": [ 650# 4, 651# 0 652# ], 653# "unicast-table": [ 654# ], 655# "multicast": "normal", 656# "multicast-overflow": false, 657# "unicast-overflow": false, 658# "multicast-table": [ 659# "01:00:5e:00:00:01", 660# "33:33:00:00:00:01", 661# "33:33:ff:12:34:56" 662# ], 663# "broadcast-allowed": false 664# } 665# ] 666# } 667# 668## 669{ 'command': 'query-rx-filter', 'data': { '*name': 'str' }, 670 'returns': ['RxFilterInfo'] } 671 672## 673# @NIC_RX_FILTER_CHANGED: 674# 675# Emitted once until the 'query-rx-filter' command is executed, the first event 676# will always be emitted 677# 678# @name: net client name 679# 680# @path: device path 681# 682# Since: 1.6 683# 684# Example: 685# 686# <- { "event": "NIC_RX_FILTER_CHANGED", 687# "data": { "name": "vnet0", 688# "path": "/machine/peripheral/vnet0/virtio-backend" }, 689# "timestamp": { "seconds": 1368697518, "microseconds": 326866 } } 690# } 691# 692## 693{ 'event': 'NIC_RX_FILTER_CHANGED', 694 'data': { '*name': 'str', 'path': 'str' } } 695