04.03.2020, 18:57, "Laurent Vivier" <lviv...@redhat.com>:
> 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 <lekir...@yandex-team.ru>
>> ---
>> 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
Somehow, I managed not to notice this feature.
Thank you for pointing this out, I will definitely fix this place.
--
Alexey Kirillov
Yandex.Cloud