Skip to content
Snippets Groups Projects
  1. Jun 11, 2021
  2. Jun 04, 2021
  3. Jun 02, 2021
  4. May 27, 2021
  5. May 04, 2021
  6. May 02, 2021
  7. Apr 23, 2021
  8. Apr 08, 2021
  9. Mar 22, 2021
  10. Mar 15, 2021
    • Alexey Kirillov's avatar
      net: Do not fill legacy info_str for backends · f2e8319d
      Alexey Kirillov authored
      
      As we use QAPI NetClientState->stored_config to store and get information
      about backend network devices, we can drop fill of legacy field info_str
      for them.
      
      We still use info_str field for NIC and hubports, so we can not completely
      remove it.
      
      Signed-off-by: default avatarAlexey Kirillov <lekiravi@yandex-team.ru>
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      f2e8319d
    • Alexey Kirillov's avatar
      hmp: Use QAPI NetdevInfo in hmp_info_network · a0724776
      Alexey Kirillov authored
      
      Replace usage of legacy field info_str of NetClientState for backend
      network devices with QAPI NetdevInfo stored_config that already used
      in QMP query-netdev.
      
      This change increases the detail of the "info network" output and takes
      a more general approach to composing the output.
      
      NIC and hubports still use legacy info_str field.
      
      Signed-off-by: default avatarAlexey Kirillov <lekiravi@yandex-team.ru>
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      a0724776
    • Alexey Kirillov's avatar
      net: Move NetClientState.info_str to dynamic allocations · 59b5437e
      Alexey Kirillov authored
      
      The info_str field of the NetClientState structure is static and has a size
      of 256 bytes. This amount is often unclaimed, and the field itself is used
      exclusively for HMP "info network".
      
      The patch translates info_str to dynamic memory allocation.
      
      This action is also allows us to painlessly discard usage of this field
      for backend devices.
      
      Signed-off-by: default avatarAlexey Kirillov <lekiravi@yandex-team.ru>
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      59b5437e
    • Alexey Kirillov's avatar
      qapi: net: Add query-netdev command · d32ad10a
      Alexey Kirillov authored
      
      The query-netdev command is used to get the configuration of the current
      network device backends (netdevs).
      This is the QMP analog of the HMP command "info network" but only for
      netdevs (i.e. excluding NIC and hubports).
      
      The query-netdev command returns an array of objects of the NetdevInfo
      type, which are an extension of Netdev type. It means that response can
      be used for netdev-add after small modification. This can be useful for
      recreate the same netdev configuration.
      
      Information about the network device is filled in when it is created or
      modified and is available through the NetClientState->stored_config.
      
      Signed-off-by: default avatarAlexey Kirillov <lekiravi@yandex-team.ru>
      Acked-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      d32ad10a
    • Jason Wang's avatar
      net: introduce qemu_receive_packet() · 705df546
      Jason Wang authored
      
      Some NIC supports loopback mode and this is done by calling
      nc->info->receive() directly which in fact suppresses the effort of
      reentrancy check that is done in qemu_net_queue_send().
      
      Unfortunately we can't use qemu_net_queue_send() here since for
      loopback there's no sender as peer, so this patch introduce a
      qemu_receive_packet() which is used for implementing loopback mode
      for a NIC with this check.
      
      NIC that supports loopback mode will be converted to this helper.
      
      This is intended to address CVE-2021-3416.
      
      Cc: Prasad J Pandit <ppandit@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      705df546
    • Paolo Bonzini's avatar
      net: validate that ids are well formed · e73b4317
      Paolo Bonzini authored
      
      When a network or network device is created from the command line or HMP,
      QemuOpts ensures that the id passes the id_wellformed check.  However,
      QMP skips this:
      
         $ qemu-system-x86_64 -qmp stdio -S -nic user,id=123/456
         qemu-system-x86_64: -nic user,id=123/456: Parameter id expects an identifier
         Identifiers consist of letters, digits, -, ., _, starting with a letter.
      
         $ qemu-system-x86_64 -qmp stdio -S
         {"execute":"qmp_capabilities"}
         {"return": {}}
         {"execute":"netdev_add", "arguments": {"type": "user", "id": "123/456"}}
         {"return": {}}
      
      After:
      
         $ qemu-system-x86_64 -qmp stdio -S
         {"execute":"qmp_capabilities"}
         {"return": {}}
         {"execute":"netdev_add", "arguments": {"type": "user", "id": "123/456"}}
         {"error": {"class": "GenericError", "desc": "Parameter "id" expects an identifier"}}
      
      Validity checks should be performed always at the bottom of the call chain,
      because QMP skips all the steps above.  At the same time we know that every
      call chain should go through either QMP or (for legacy) through QemuOpts.
      Because the id for -net and -nic is automatically generated and not
      well-formed by design, just add the check to QMP.
      
      Cc: Jason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      e73b4317
    • Bin Meng's avatar
      net: Fix build error when DEBUG_NET is on · 26d0586f
      Bin Meng authored
      
      "qemu-common.h" should be included to provide the forward declaration
      of qemu_hexdump() when DEBUG_NET is on.
      
      Signed-off-by: default avatarBin Meng <bin.meng@windriver.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      26d0586f
  11. Mar 09, 2021
Loading