From patchwork Thu Oct 8 18:58:26 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark McLoughlin X-Patchwork-Id: 35506 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 CE75EB7B65 for ; Fri, 9 Oct 2009 06:08:26 +1100 (EST) Received: from localhost ([127.0.0.1]:51912 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvyLf-0001vW-SF for incoming@patchwork.ozlabs.org; Thu, 08 Oct 2009 15:08:23 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MvyDw-00068J-7x for qemu-devel@nongnu.org; Thu, 08 Oct 2009 15:00:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MvyDr-00066U-Gq for qemu-devel@nongnu.org; Thu, 08 Oct 2009 15:00:23 -0400 Received: from [199.232.76.173] (port=52324 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvyDr-00066B-AM for qemu-devel@nongnu.org; Thu, 08 Oct 2009 15:00:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11852) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MvyDq-0006x6-Kq for qemu-devel@nongnu.org; Thu, 08 Oct 2009 15:00:18 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n98J0EcM021812 for ; Thu, 8 Oct 2009 15:00:18 -0400 Received: from blaa.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n98J0Dv5013165; Thu, 8 Oct 2009 15:00:14 -0400 Received: by blaa.localdomain (Postfix, from userid 500) id 64A7251746; Thu, 8 Oct 2009 19:58:33 +0100 (IST) From: Mark McLoughlin To: qemu-devel@nongnu.org Date: Thu, 8 Oct 2009 19:58:26 +0100 Message-Id: <1255028312-28180-11-git-send-email-markmc@redhat.com> In-Reply-To: <1255028312-28180-1-git-send-email-markmc@redhat.com> References: <1255028312-28180-1-git-send-email-markmc@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Mark McLoughlin Subject: [Qemu-devel] [PATCH 10/16] net: add -netdev option 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 Signed-off-by: Mark McLoughlin --- qemu-config.c | 13 +++++++++++++ qemu-config.h | 1 + qemu-options.hx | 10 ++++++++++ vl.c | 5 +++++ 4 files changed, 29 insertions(+), 0 deletions(-) diff --git a/qemu-config.c b/qemu-config.c index bafaea2..cae92f7 100644 --- a/qemu-config.c +++ b/qemu-config.c @@ -152,6 +152,18 @@ QemuOptsList qemu_device_opts = { }, }; +QemuOptsList qemu_netdev_opts = { + .name = "netdev", + .head = QTAILQ_HEAD_INITIALIZER(qemu_netdev_opts.head), + .desc = { + /* + * no elements => accept any params + * validation will happen later + */ + { /* end of list */ } + }, +}; + QemuOptsList qemu_net_opts = { .name = "net", .head = QTAILQ_HEAD_INITIALIZER(qemu_net_opts.head), @@ -188,6 +200,7 @@ static QemuOptsList *lists[] = { &qemu_drive_opts, &qemu_chardev_opts, &qemu_device_opts, + &qemu_netdev_opts, &qemu_net_opts, &qemu_rtc_opts, NULL, diff --git a/qemu-config.h b/qemu-config.h index cdad5ac..3cc8864 100644 --- a/qemu-config.h +++ b/qemu-config.h @@ -4,6 +4,7 @@ extern QemuOptsList qemu_drive_opts; extern QemuOptsList qemu_chardev_opts; extern QemuOptsList qemu_device_opts; +extern QemuOptsList qemu_netdev_opts; extern QemuOptsList qemu_net_opts; extern QemuOptsList qemu_rtc_opts; diff --git a/qemu-options.hx b/qemu-options.hx index 3dd76b3..d4cac04 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -839,6 +839,16 @@ DEF("net", HAS_ARG, QEMU_OPTION_net, " dump traffic on vlan 'n' to file 'f' (max n bytes per packet)\n" "-net none use it alone to have zero network devices; if no -net option\n" " is provided, the default is '-net nic -net user'\n") +DEF("netdev", HAS_ARG, QEMU_OPTION_netdev, + "-netdev [" +#ifdef CONFIG_SLIRP + "user|" +#endif + "tap|" +#ifdef CONFIG_VDE + "vde|" +#endif + "socket],id=str[,option][,option][,...]\n") STEXI @item -net nic[,vlan=@var{n}][,macaddr=@var{mac}][,model=@var{type}][,name=@var{name}][,addr=@var{addr}][,vectors=@var{v}] Create a new Network Interface Card and connect it to VLAN @var{n} (@var{n} diff --git a/vl.c b/vl.c index 13e56bc..49fea66 100644 --- a/vl.c +++ b/vl.c @@ -5087,6 +5087,11 @@ int main(int argc, char **argv, char **envp) fd_bootchk = 0; break; #endif + case QEMU_OPTION_netdev: + if (net_client_parse(&qemu_netdev_opts, optarg) == -1) { + exit(1); + } + break; case QEMU_OPTION_net: if (net_client_parse(&qemu_net_opts, optarg) == -1) { exit(1);