qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Cc: yuri.benditovich@daynix.com, jasowang@redhat.com,
	qemu-stable@nongnu.org, andrew@daynix.com,
	peter.maydell@linaro.org
Subject: Re: [PATCH 1/1] net: Fix handling of id in netdev_add and netdev_del
Date: Wed, 25 Nov 2020 07:18:09 -0600	[thread overview]
Message-ID: <abaa78a8-1228-8517-1bcd-3afcefc47251@redhat.com> (raw)
In-Reply-To: <20201125100220.50251-2-armbru@redhat.com>

On 11/25/20 4:02 AM, Markus Armbruster wrote:
> CLI -netdev accumulates in option group "netdev".
> 
> Before commit 08712fcb85 "net: Track netdevs in NetClientState rather
> than QemuOpt", netdev_add added to the option group, and netdev_del
> removed from it, both HMP and QMP.  Thus, every netdev had a
> corresponding QemuOpts in this option group.
> 
> Commit 08712fcb85 dropped this for QMP netdev_add and both netdev_del.
> Now a netdev has a corresponding QemuOpts only when it was created
> with CLI or HMP.  Two issues:
> 
> * QMP and HMP netdev_del can leave QemuOpts behind, breaking HMP
>   netdev_add.  Reproducer:
> 
>     $ qemu-system-x86_64 -S -display none -nodefaults -monitor stdio
>     QEMU 5.1.92 monitor - type 'help' for more information
>     (qemu) netdev_add user,id=net0
>     (qemu) info network
>     net0: index=0,type=user,net=10.0.2.0,restrict=off
>     (qemu) netdev_del net0
>     (qemu) info network
>     (qemu) netdev_add user,id=net0
>     upstream-qemu: Duplicate ID 'net0' for netdev
>     Try "help netdev_add" for more information
> 
>   Fix by restoring the QemuOpts deletion in qmp_netdev_del(), but with
>   a guard, because the QemuOpts need not exist.
> 
> * QMP netdev_add loses its "no duplicate ID" check.  Reproducer:
> 
>     $ qemu-system-x86_64 -S -display none -qmp stdio
>     {"QMP": {"version": {"qemu": {"micro": 92, "minor": 1, "major": 5}, "package": "v5.2.0-rc2-1-g02c1f0142c"}, "capabilities": ["oob"]}}
>     {"execute": "qmp_capabilities"}
>     {"return": {}}
>     {"execute": "netdev_add", "arguments": {"type": "user", "id":"net0"}}
>     {"return": {}}
>     {"execute": "netdev_add", "arguments": {"type": "user", "id":"net0"}}
>     {"return": {}}
> 
>   Fix by adding a duplicate ID check to net_client_init1() to replace
>   the lost one.  The check is redundant for callers where QemuOpts
>   still checks, i.e. for CLI and HMP.
> 
> Reported-by: Andrew Melnichenko <andrew@daynix.com>
> Fixes: 08712fcb851034228b61f75bd922863a984a4f60
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  net/net.c | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)

The adventure in QAPIfication of netdev_add has been long.  Thanks for
working on this.

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



  reply	other threads:[~2020-11-25 13:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-25 10:02 [PATCH 0/1] net: Fix handling of id in netdev_add and netdev_del Markus Armbruster
2020-11-25 10:02 ` [PATCH 1/1] " Markus Armbruster
2020-11-25 13:18   ` Eric Blake [this message]
2020-11-27  5:25 ` [PATCH 0/1] " Jason Wang
2020-11-27  9:12   ` Markus Armbruster
2021-01-15 13:56   ` Markus Armbruster
2021-01-18  2:49     ` Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=abaa78a8-1228-8517-1bcd-3afcefc47251@redhat.com \
    --to=eblake@redhat.com \
    --cc=andrew@daynix.com \
    --cc=armbru@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=yuri.benditovich@daynix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).