From patchwork Mon Oct 12 08:52:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark McLoughlin X-Patchwork-Id: 35736 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8693EB7B71 for ; Mon, 12 Oct 2009 19:54:32 +1100 (EST) Received: from localhost ([127.0.0.1]:53755 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MxGfl-0008SD-NR for incoming@patchwork.ozlabs.org; Mon, 12 Oct 2009 04:54:29 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MxGf9-0008Re-Bl for qemu-devel@nongnu.org; Mon, 12 Oct 2009 04:53:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MxGf1-0008Pg-Ok for qemu-devel@nongnu.org; Mon, 12 Oct 2009 04:53:48 -0400 Received: from [199.232.76.173] (port=35684 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MxGf1-0008Pb-16 for qemu-devel@nongnu.org; Mon, 12 Oct 2009 04:53:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5270) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MxGez-0000M8-3V for qemu-devel@nongnu.org; Mon, 12 Oct 2009 04:53:42 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9C8rdgI024642 for ; Mon, 12 Oct 2009 04:53:39 -0400 Received: from blaa.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9C8rcGd024055; Mon, 12 Oct 2009 04:53:38 -0400 Received: by blaa.localdomain (Postfix, from userid 500) id 3E2551D784; Mon, 12 Oct 2009 09:52:00 +0100 (IST) From: Mark McLoughlin To: qemu-devel@nongnu.org Date: Mon, 12 Oct 2009 09:52:00 +0100 Message-Id: <1255337520-30381-1-git-send-email-markmc@redhat.com> In-Reply-To: <4AD0DAC8.90209@dlh.net> References: <4AD0DAC8.90209@dlh.net> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Mark McLoughlin Subject: [Qemu-devel] [PATCH 1/1] net: fix multiple NICs causing net opts process to stop X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org For NICs, net_init_client() returns the index into the NICInfo table. qemu_opts_foreach() interprets non-zero as an error return an stops iterating over the options. So, if you have more than one '-net nic' on the command line, subsequent '-net' options do not get processed. Fix this by making net_client_init() only return non-zero if net_init_client() returns an error. Reported-by: Peter Lieven Signed-off-by: Mark McLoughlin --- net.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/net.c b/net.c index 2e4dd58..7cee404 100644 --- a/net.c +++ b/net.c @@ -3203,7 +3203,9 @@ static void net_check_clients(void) static int net_init_client(QemuOpts *opts, void *dummy) { - return net_client_init(NULL, opts); + if (net_client_init(NULL, opts) < 0) + return -1; + return 0; } int net_init_clients(void)