qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 1/4] qapi: net: Add query-netdevs command


From: Laurent Vivier
Subject: Re: [PATCH v2 1/4] qapi: net: Add query-netdevs command
Date: Wed, 4 Mar 2020 16:57:11 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

On 04/03/2020 14:06, Alexey Kirillov wrote:
> Add a qmp command that provides information about currently attached
> network devices and their configuration.
> 
> Signed-off-by: Alexey Kirillov <address@hidden>
> ---
>  include/net/net.h |   1 +
>  net/hub.c         |   8 +++
>  net/l2tpv3.c      |  19 +++++++
>  net/net.c         |  91 +++++++++++++++++++++++++++++++++
>  net/netmap.c      |  13 +++++
>  net/slirp.c       | 126 ++++++++++++++++++++++++++++++++++++++++++++++
>  net/socket.c      |  71 ++++++++++++++++++++++++++
>  net/tap-win32.c   |   9 ++++
>  net/tap.c         | 103 +++++++++++++++++++++++++++++++++++--
>  net/vde.c         |  26 ++++++++++
>  net/vhost-user.c  |  18 +++++--
>  qapi/net.json     |  89 ++++++++++++++++++++++++++++++++
>  12 files changed, 566 insertions(+), 8 deletions(-)
> 
...
> diff --git a/net/net.c b/net/net.c
> index 9e93c3f8a1..01e0548295 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -54,6 +54,7 @@
>  #include "sysemu/sysemu.h"
>  #include "net/filter.h"
>  #include "qapi/string-output-visitor.h"
> +#include "qapi/clone-visitor.h"
>  
>  /* Net bridge is currently not supported for W32. */
>  #if !defined(_WIN32)
> @@ -128,6 +129,12 @@ char *qemu_mac_strdup_printf(const uint8_t *macaddr)
>  
>  void qemu_format_nic_info_str(NetClientState *nc, uint8_t macaddr[6])
>  {
> +    g_assert(nc->stored_config);
> +
> +    g_free(nc->stored_config->u.nic.macaddr);
> +    nc->stored_config->u.nic.macaddr = g_strdup_printf(MAC_FMT,
> +                                                       MAC_ARG(macaddr));
> +

Why do you use this rather than the qemu_mac_strdup_printf() function
defined above?

qemu_mac_strdup_printf():
  890ee6abb385 ("net: add MAC address string printer")

MAC_FMT/MAC_ARG:
  6d1d4939a647 ("net: Add macros for MAC address tracing")

MAC_FMT/MAC_ARG seems to be reserved for tracing.

Thanks,
Laurent




reply via email to

[Prev in Thread] Current Thread [Next in Thread]