From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Mark McLoughlin 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> Subject: [Qemu-devel] [PATCH 1/1] net: fix multiple NICs causing net opts process to stop List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Mark McLoughlin 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) -- 1.6.2.5