Received: from eggs.gnu.org ([2001:4830:134:3::10]:54912) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boRlM-00072U-9y for qemu-devel@nongnu.org; Mon, 26 Sep 2016 04:59:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1boRlK-0008Fy-5A for qemu-devel@nongnu.org; Mon, 26 Sep 2016 04:59:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37464) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boRlJ-0008Fq-Um for qemu-devel@nongnu.org; Mon, 26 Sep 2016 04:59:46 -0400 From: Jason Wang Date: Mon, 26 Sep 2016 16:59:10 +0800 Message-Id: <1474880375-22946-3-git-send-email-jasowang@redhat.com> In-Reply-To: <1474880375-22946-1-git-send-email-jasowang@redhat.com> References: <1474880375-22946-1-git-send-email-jasowang@redhat.com> Subject: [Qemu-devel] [PULL 02/27] net: hmp_host_net_remove: Del the -net option of the removed host_net List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: qemu-devel@nongnu.org, Shmulik Ladkani , Shmulik Ladkani , Jason Wang From: Shmulik Ladkani Upon hmp_host_net_remove(), the appropriate -net client is deleted (according to the given vlan_id and device id), as well as the corresponsing hub port. However, the relevant '-net' option that was added by former hmp_host_net_add() call is still present in "net" options group. This makes the following legit HMP sequence erroneous: (qemu) host_net_add tap id=n1,ifname=tap1,script=no,downscript=no,vlan=1 (qemu) host_net_remove 1 n1 (qemu) host_net_add tap id=n1,ifname=tap1,script=no,downscript=no,vlan=1 Duplicate ID 'n1' for net Fix, by deleting the stored '-net' option associated with the given device id. Signed-off-by: Shmulik Ladkani Signed-off-by: Jason Wang --- net/net.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/net.c b/net/net.c index d51cb29..0bec096 100644 --- a/net/net.c +++ b/net/net.c @@ -1179,6 +1179,7 @@ void hmp_host_net_remove(Monitor *mon, const QDict *qdict) qemu_del_net_client(nc->peer); qemu_del_net_client(nc); + qemu_opts_del(qemu_opts_find(qemu_find_opts("net"), device)); } void netdev_add(QemuOpts *opts, Error **errp) -- 2.7.4