From patchwork Tue Feb 7 01:16:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Bryant X-Patchwork-Id: 139870 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3B3021007D3 for ; Tue, 7 Feb 2012 12:16:29 +1100 (EST) Received: from localhost ([::1]:39098 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RuZfW-0002ak-RB for incoming@patchwork.ozlabs.org; Mon, 06 Feb 2012 20:16:26 -0500 Received: from eggs.gnu.org ([140.186.70.92]:59010) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RuZfO-0002ad-T7 for qemu-devel@nongnu.org; Mon, 06 Feb 2012 20:16:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RuZfN-0002Ob-GL for qemu-devel@nongnu.org; Mon, 06 Feb 2012 20:16:18 -0500 Received: from e7.ny.us.ibm.com ([32.97.182.137]:52398) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RuZfN-0002OW-By for qemu-devel@nongnu.org; Mon, 06 Feb 2012 20:16:17 -0500 Received: from /spool/local by e7.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 6 Feb 2012 20:16:16 -0500 Received: from d01dlp02.pok.ibm.com (9.56.224.85) by e7.ny.us.ibm.com (192.168.1.107) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 6 Feb 2012 20:16:12 -0500 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 454D66E804A for ; Mon, 6 Feb 2012 20:16:12 -0500 (EST) Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q171GCQL244156 for ; Mon, 6 Feb 2012 20:16:12 -0500 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q171GBMn025370 for ; Mon, 6 Feb 2012 20:16:11 -0500 Received: from localhost (dyn9050016121.mts.ibm.com [9.50.16.121] (may be forged)) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q171GBAe025342; Mon, 6 Feb 2012 20:16:11 -0500 From: Corey Bryant To: qemu-devel@nongnu.org Date: Mon, 6 Feb 2012 20:16:11 -0500 Message-Id: <1328577371-19939-1-git-send-email-coreyb@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.3.4 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12020701-5806-0000-0000-00001224A750 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 32.97.182.137 Cc: sw@weilnetz.de, aliguori@us.ibm.com, rmarwah@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH] Change "-net tap, helper" to "-net tap, bridgehelper" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The purpose of the "helper" option for "-net tap" isn't obvious based on its name. This patch changes the option name to "bridgehelper" to make its purpose more self-documenting. With this patch, a typical invocation will be similar to one of the following (where the default bridge is br0): qemu linux.img -net tap,bridgehelper="/usr/local/libexec/qemu-bridge-helper" -net nic,model=virtio qemu linux.img -netdev tap,bridgehelper="/usr/local/libexec/qemu-bridge-helper",id=hn0 -device virtio-net-pci,netdev=hn0,id=nic1 Alternatively, if a user wants to use a different bridge, a typical invocation would be simliar to one of the following: qemu linux.img -net tap,bridgehelper="/usr/local/libexec/qemu-bridge-helper --br=qemubr0" -net nic,model=virtio qemu linux.img -netdev tap,bridgehelper="/usr/local/libexec/qemu-bridge-helper --br=qemubr0",id=hn0 -device virtio-net-pci,netdev=hn0,id=nic1 Signed-off-by: Corey Bryant --- net.c | 2 +- net/tap.c | 14 +++++++------- qemu-options.hx | 24 ++++++++++++------------ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/net.c b/net.c index c34474f..3773739 100644 --- a/net.c +++ b/net.c @@ -958,7 +958,7 @@ static const struct { .help = "script to shut down the interface", }, { #ifdef CONFIG_NET_BRIDGE - .name = "helper", + .name = "bridgehelper", .type = QEMU_OPT_STRING, .help = "command to execute to configure bridge", }, { diff --git a/net/tap.c b/net/tap.c index f240028..d39c787 100644 --- a/net/tap.c +++ b/net/tap.c @@ -594,9 +594,9 @@ int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan qemu_opt_get(opts, "script") || qemu_opt_get(opts, "downscript") || qemu_opt_get(opts, "vnet_hdr") || - qemu_opt_get(opts, "helper")) { + qemu_opt_get(opts, "bridgehelper")) { error_report("ifname=, script=, downscript=, vnet_hdr=, " - "and helper= are invalid with fd="); + "and bridgehelper= are invalid with fd="); return -1; } @@ -611,17 +611,17 @@ int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan model = "tap"; - } else if (qemu_opt_get(opts, "helper")) { + } else if (qemu_opt_get(opts, "bridgehelper")) { if (qemu_opt_get(opts, "ifname") || qemu_opt_get(opts, "script") || qemu_opt_get(opts, "downscript") || qemu_opt_get(opts, "vnet_hdr")) { error_report("ifname=, script=, downscript=, and vnet_hdr= " - "are invalid with helper="); + "are invalid with bridgehelper="); return -1; } - fd = net_bridge_run_helper(qemu_opt_get(opts, "helper"), + fd = net_bridge_run_helper(qemu_opt_get(opts, "bridgehelper"), DEFAULT_BRIDGE_INTERFACE); if (fd == -1) { return -1; @@ -662,9 +662,9 @@ int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan if (qemu_opt_get(opts, "fd")) { snprintf(s->nc.info_str, sizeof(s->nc.info_str), "fd=%d", fd); - } else if (qemu_opt_get(opts, "helper")) { + } else if (qemu_opt_get(opts, "bridgehelper")) { snprintf(s->nc.info_str, sizeof(s->nc.info_str), - "helper=%s", qemu_opt_get(opts, "helper")); + "bridgehelper=%s", qemu_opt_get(opts, "bridgehelper")); } else { const char *ifname, *script, *downscript; diff --git a/qemu-options.hx b/qemu-options.hx index 19906e5..d484aef 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1222,13 +1222,13 @@ DEF("net", HAS_ARG, QEMU_OPTION_net, "-net tap[,vlan=n][,name=str],ifname=name\n" " connect the host TAP network interface to VLAN 'n'\n" #else - "-net tap[,vlan=n][,name=str][,fd=h][,ifname=name][,script=file][,downscript=dfile][,helper=helper][,sndbuf=nbytes][,vnet_hdr=on|off][,vhost=on|off][,vhostfd=h][,vhostforce=on|off]\n" + "-net tap[,vlan=n][,name=str][,fd=h][,ifname=name][,script=file][,downscript=dfile][,bridgehelper=helper][,sndbuf=nbytes][,vnet_hdr=on|off][,vhost=on|off][,vhostfd=h][,vhostforce=on|off]\n" " connect the host TAP network interface to VLAN 'n' \n" " use network scripts 'file' (default=" DEFAULT_NETWORK_SCRIPT ")\n" " to configure it and 'dfile' (default=" DEFAULT_NETWORK_DOWN_SCRIPT ")\n" " to deconfigure it\n" " use '[down]script=no' to disable script execution\n" - " use network helper 'helper' (default=" DEFAULT_BRIDGE_HELPER ") to\n" + " use bridgehelper command 'helper' (default=" DEFAULT_BRIDGE_HELPER ") to\n" " configure it\n" " use 'fd=h' to connect to an already opened TAP interface\n" " use 'sndbuf=nbytes' to limit the size of the send buffer (the\n" @@ -1405,7 +1405,7 @@ processed and applied to -net user. Mixing them with the new configuration syntax gives undefined results. Their use for new applications is discouraged as they will be removed from future versions. -@item -net tap[,vlan=@var{n}][,name=@var{name}][,fd=@var{h}][,ifname=@var{name}][,script=@var{file}][,downscript=@var{dfile}][,helper=@var{helper}] +@item -net tap[,vlan=@var{n}][,name=@var{name}][,fd=@var{h}][,ifname=@var{name}][,script=@var{file}][,downscript=@var{dfile}][,bridgehelper=@var{helper}] Connect the host TAP network interface @var{name} to VLAN @var{n}. Use the network script @var{file} to configure it and the network script @@ -1415,9 +1415,9 @@ automatically provides one. The default network configure script is @file{/etc/qemu-ifdown}. Use @option{script=no} or @option{downscript=no} to disable script execution. -If running QEMU as an unprivileged user, use the network helper -@var{helper} to configure the TAP interface. The default network -helper executable is @file{/usr/local/libexec/qemu-bridge-helper}. +If running QEMU as an unprivileged user, use the bridge helper command +@var{helper} to configure the TAP interface. The default bridge helper +executable is @file{/usr/local/libexec/qemu-bridge-helper}. @option{fd}=@var{h} can be used to specify the handle of an already opened host TAP interface. @@ -1437,29 +1437,29 @@ qemu linux.img -net nic,vlan=0 -net tap,vlan=0,ifname=tap0 \ @end example @example -#launch a QEMU instance with the default network helper to +#launch a QEMU instance with the default bridge helper to #connect a TAP device to bridge br0 -qemu linux.img -net nic -net tap,"helper=/usr/local/libexec/qemu-bridge-helper" +qemu linux.img -net nic -net tap,"bridgehelper=/usr/local/libexec/qemu-bridge-helper" @end example @item -net bridge[,vlan=@var{n}][,name=@var{name}][,br=@var{bridge}][,helper=@var{helper}] Connect a host TAP network interface to a host bridge device. -Use the network helper @var{helper} to configure the TAP interface and -attach it to the bridge. The default network helper executable is +Use the bridge helper @var{helper} to configure the TAP interface and +attach it to the bridge. The default bridge helper executable is @file{/usr/local/libexec/qemu-bridge-helper} and the default bridge device is @file{br0}. Examples: @example -#launch a QEMU instance with the default network helper to +#launch a QEMU instance with the default bridge helper to #connect a TAP device to bridge br0 qemu linux.img -net bridge -net nic,model=virtio @end example @example -#launch a QEMU instance with the default network helper to +#launch a QEMU instance with the default bridge helper to #connect a TAP device to bridge qemubr0 qemu linux.img -net bridge,br=qemubr0 -net nic,model=virtio @end example