[v2,0/4] Introducing QMP query-netdevs command
mbox series

Message ID 20200304130656.16859-1-lekiravi@yandex-team.ru
Headers show
Series
  • Introducing QMP query-netdevs command
Related show

Message

Alexey Kirillov March 4, 2020, 1:06 p.m. UTC
This patch series introduces a new QMP command "query-netdevs" to get
information about currently attached network devices.
Also, since the "info_str" field of "NetClientState" is now deprecated,
it has been completely removed.
The HMP command "info network" now also uses the new QMP command inside.

Usage example:

-> { "execute": "query-netdevs" }
<- { "return": [
         {
             "peer": "netdev0",
             "netdev": "netdev0",
             "perm-mac": "52:54:00:12:34:56"
             "model": "virtio-net-pci",
             "macaddr": "52:54:00:12:34:56",
             "queues-count": 1,
             "type": "nic",
             "id": "net0"
         },
         {
             "peer": "net0",
             "ipv6": true,
             "ipv4": true,
             "host": "10.0.2.2",
             "queues-count": 1,
             "ipv6-dns": "fec0::3",
             "ipv6-prefix": "fec0::",
             "net": "10.0.2.0/255.255.255.0",
             "ipv6-host": "fec0::2",
             "type": "user",
             "dns": "10.0.2.3",
             "hostfwd": [
                 {
                     "str": "tcp::20004-:22"
                 }
             ],
             "ipv6-prefixlen": 64,
             "id": "netdev0",
             "restrict": false
         }
     ]
   }

v2->v1:
- Rewrite HMP "info network" to get information from results of QMP command.
- Remove obsolete field "info_str" from "NetClientState".

Alexey Kirillov (4):
  qapi: net: Add query-netdevs command
  tests: Add tests for query-netdevs command
  hmp: Use QMP query-netdevs in hmp_info_network
  net: Remove field info_str of NetClientState

 hw/net/allwinner_emac.c          |   2 +-
 hw/net/dp8393x.c                 |   2 +-
 hw/net/e1000.c                   |   4 +-
 hw/net/e1000e.c                  |   2 +-
 hw/net/e1000e_core.c             |   2 +-
 hw/net/e1000x_common.c           |   2 +-
 hw/net/eepro100.c                |   5 +-
 hw/net/etraxfs_eth.c             |   2 +-
 hw/net/fsl_etsec/etsec.c         |   2 +-
 hw/net/ftgmac100.c               |   2 +-
 hw/net/i82596.c                  |   6 +-
 hw/net/imx_fec.c                 |   2 +-
 hw/net/lan9118.c                 |   4 +-
 hw/net/mcf_fec.c                 |   2 +-
 hw/net/milkymist-minimac2.c      |   2 +-
 hw/net/mipsnet.c                 |   2 +-
 hw/net/ne2000-isa.c              |   2 +-
 hw/net/ne2000-pci.c              |   2 +-
 hw/net/pcnet.c                   |   2 +-
 hw/net/rocker/rocker_fp.c        |   4 +-
 hw/net/rtl8139.c                 |   6 +-
 hw/net/smc91c111.c               |   2 +-
 hw/net/spapr_llan.c              |   6 +-
 hw/net/stellaris_enet.c          |   2 +-
 hw/net/sungem.c                  |   4 +-
 hw/net/sunhme.c                  |   2 +-
 hw/net/tulip.c                   |   2 +-
 hw/net/virtio-net.c              |   8 +-
 hw/net/vmxnet3.c                 |   4 +-
 hw/net/xen_nic.c                 |   4 -
 hw/net/xgmac.c                   |   2 +-
 hw/net/xilinx_axienet.c          |   2 +-
 hw/net/xilinx_ethlite.c          |   2 +-
 hw/usb/dev-network.c             |   2 +-
 include/net/net.h                |   7 +-
 net/clients.h                    |   1 +
 net/hub.c                        |  12 +-
 net/hub.h                        |   2 +-
 net/l2tpv3.c                     |  20 ++-
 net/net.c                        | 272 +++++++++++++++++++++++++++++--
 net/netmap.c                     |  13 ++
 net/slirp.c                      | 128 ++++++++++++++-
 net/socket.c                     |  93 ++++++++---
 net/tap-win32.c                  |   9 +
 net/tap.c                        | 107 ++++++++++--
 net/vde.c                        |  40 ++++-
 net/vhost-user.c                 |  20 ++-
 qapi/net.json                    |  89 ++++++++++
 tests/qtest/Makefile.include     |   2 +
 tests/qtest/test-query-netdevs.c | 120 ++++++++++++++
 50 files changed, 917 insertions(+), 119 deletions(-)
 create mode 100644 tests/qtest/test-query-netdevs.c