From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:60203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLdBP-00029d-EZ for qemu-devel@nongnu.org; Wed, 02 Nov 2011 11:56:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RLdBO-0000YM-14 for qemu-devel@nongnu.org; Wed, 02 Nov 2011 11:56:55 -0400 Received: from e5.ny.us.ibm.com ([32.97.182.145]:55608) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLdBN-0000Y0-Rr for qemu-devel@nongnu.org; Wed, 02 Nov 2011 11:56:53 -0400 Received: from /spool/local by e5.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 2 Nov 2011 11:53:04 -0400 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay06.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pA2FqbLm3342362 for ; Wed, 2 Nov 2011 11:52:37 -0400 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 pA2FqXaw010882 for ; Wed, 2 Nov 2011 11:52:36 -0400 Message-ID: <4EB1673C.7060407@linux.vnet.ibm.com> Date: Wed, 02 Nov 2011 11:52:28 -0400 From: Corey Bryant MIME-Version: 1.0 References: <1320167638-8895-1-git-send-email-coreyb@linux.vnet.ibm.com> <1320167638-8895-5-git-send-email-coreyb@linux.vnet.ibm.com> <4EB0FB75.7050307@linux.vnet.ibm.com> In-Reply-To: <4EB0FB75.7050307@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 4/4] Add support for net bridge List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mark Wu Cc: rmarwah@linux.vnet.ibm.com, aliguori@us.ibm.com, qemu-devel@nongnu.org On 11/02/2011 04:12 AM, Mark Wu wrote: > On 11/02/2011 01:13 AM, Corey Bryant wrote: >> static int net_tap_init(QemuOpts *opts, int *vnet_hdr) >> { >> int fd, vnet_hdr_required; >> @@ -433,8 +570,11 @@ int net_init_tap(QemuOpts *opts, Monitor *mon, >> const char *name, VLANState *vlan >> 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= is invalid >> with fd="); >> + qemu_opt_get(opts, "vnet_hdr") || >> + qemu_opt_get(opts, "br") || >> + qemu_opt_get(opts, "helper")) { >> + error_report("ifname=, script=, downscript=, vnet_hdr=," >> + "br= and helper= are invalid with fd="); >> return -1; >> } > If >> @@ -446,7 +586,40 @@ int net_init_tap(QemuOpts *opts, Monitor *mon, >> const char *name, VLANState *vlan >> fcntl(fd, F_SETFL, O_NONBLOCK); >> >> vnet_hdr = tap_probe_vnet_hdr(fd); >> + } else if (qemu_opt_get(opts, "helper")) { >> + if (qemu_opt_get(opts, "ifname") || >> + qemu_opt_get(opts, "script") || >> + qemu_opt_get(opts, "downscript")) { >> + error_report("ifname=, script= and downscript=" >> + "are invalid with helper="); >> + return -1; >> + } >> + >> + if (!qemu_opt_get(opts, "br")) { >> + qemu_opt_set(opts, "br", DEFAULT_BRIDGE_INTERFACE); >> + } >> + >> + fd = net_bridge_run_helper(qemu_opt_get(opts, "helper"), >> + qemu_opt_get(opts, "br")); >> + if (fd == -1) { >> + return -1; >> + } >> + >> + fcntl(fd, F_SETFL, O_NONBLOCK); >> + >> + vnet_hdr = tap_probe_vnet_hdr(fd); >> + >> + s = net_tap_fd_init(vlan, "bridge", name, fd, vnet_hdr); >> > The helper run with "--use-vnet" by default, so the option "vnet_hdr" > will not be honored. We can make "vnet_hdr" invalid with "br" or check > the option "vnet_hdr" in function net_bridge_run_helper. > Good point. It seems like we should honor the "vnet_hdr" option rather than make it invalid for a network helper. -- Regards, Corey