From patchwork Mon Sep 5 09:11:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shmulik Ladkani X-Patchwork-Id: 9313299 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 40045607D3 for ; Mon, 5 Sep 2016 09:41:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29A3628A24 for ; Mon, 5 Sep 2016 09:41:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E6C828A25; Mon, 5 Sep 2016 09:41:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EDDB128A21 for ; Mon, 5 Sep 2016 09:41:51 +0000 (UTC) Received: from localhost ([::1]:53377 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgqPW-0003yC-Ro for patchwork-qemu-devel@patchwork.kernel.org; Mon, 05 Sep 2016 05:41:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58189) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgpwS-0004wi-9g for qemu-devel@nongnu.org; Mon, 05 Sep 2016 05:11:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bgpwM-0003hA-Tc for qemu-devel@nongnu.org; Mon, 05 Sep 2016 05:11:48 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:34636) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgpwM-0003gy-Mg for qemu-devel@nongnu.org; Mon, 05 Sep 2016 05:11:42 -0400 Received: by mail-wm0-x244.google.com with SMTP id w12so2768431wmf.1 for ; Mon, 05 Sep 2016 02:11:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=XbFEV/viiogPZhNqzdW2aT6EaqiW2lxi59IJ0xdAZBU=; b=PIaK2fB2dNur3McFWDgYktLo+6Q7u8ePg3hdj95/fNLe0qvcB7joa+TwjV6fwR5sWv oRhS4CjCUnkZ9NMEVVv1qLZ8Iw3gwQUkKS4dUtz3Q1MjmVqBxZCjJssoCtPVXPk6EL/i VDSm5btGRs1X2o7bVOq5LrzF/8Zav8SbGwspm2NhwXcTlwEWhlBi8ejUOUsUCJVEcwvR obZ+8Bb7nDtJZFX1+Tfxz6aJUGdgOrd1rlOVVsb2Q7MOlmHlucWoJJyZJ2cEgPl7F/uo 4whMEe3wVeyHE8LZxBrNVY9VUdjS6rEVAcfBoQgsbE9r0+7hLGsLvt0QlFbKUPUbu6ji D4NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=XbFEV/viiogPZhNqzdW2aT6EaqiW2lxi59IJ0xdAZBU=; b=dsmC1RJjFfIK/7rPSlfJ4+m4sIoaIOVJ6nA0l6fNpiZplUpYFCyxP5IW/osIaLMTvO nIvDajAyl4GqVa0tU4CHwu8o2Mxvr//fbmscYcddHJYUBsEKIRbRpv6Ke2knUNQuKrbW ZfTwg/kDzV5auqwE5txdBXaNvFXfCZCF5bUDuZcJDM3T+aQS4MBsLqWJrgxGn8ftpSl0 tVoY9gbkHU/jOKus+UITFLggkxTLpyel3ZEOLBk4LrLIAh0rEsAlK0QI18i2PW0/ZhH8 pYjGvQcWOHaRucgCemZNDLxCphsssvq19AZxntQqrOYYmLixSekASPgoJlBSOu3kwt7r BRhQ== X-Gm-Message-State: AE9vXwND9jLV+B9Rq+i+wxhpqPWSd1L0m/5ZW+O7GquOBRl2yNqfvRrSayIbkdwVvKn8Lg== X-Received: by 10.28.175.16 with SMTP id y16mr15043742wme.64.1473066701792; Mon, 05 Sep 2016 02:11:41 -0700 (PDT) Received: from halley.ravello.local ([5.102.195.208]) by smtp.gmail.com with ESMTPSA id a18sm2918204wma.5.2016.09.05.02.11.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Sep 2016 02:11:41 -0700 (PDT) From: Shmulik Ladkani X-Google-Original-From: Shmulik Ladkani To: Jason Wang Date: Mon, 5 Sep 2016 12:11:02 +0300 Message-Id: <1473066662-4167-1-git-send-email-shmulik.ladkani@ravellosystems.com> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PATCH] net: hmp_host_net_remove: Del the -net option of the removed host_net X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: idan.brown@ravellosystems.com, qemu-devel@nongnu.org, Shmulik Ladkani Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- net/net.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/net.c b/net/net.c index d51cb29882..0bec096d75 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)