From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:35014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLVxB-0000Cv-CL for qemu-devel@nongnu.org; Wed, 02 Nov 2011 04:13:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RLVxA-000762-FU for qemu-devel@nongnu.org; Wed, 02 Nov 2011 04:13:45 -0400 Received: from e28smtp03.in.ibm.com ([122.248.162.3]:56447) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLVx9-0006uf-BD for qemu-devel@nongnu.org; Wed, 02 Nov 2011 04:13:44 -0400 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by e28smtp03.in.ibm.com (8.14.4/8.13.1) with ESMTP id pA28DXd7020792 for ; Wed, 2 Nov 2011 13:43:33 +0530 Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pA28DWUh2965534 for ; Wed, 2 Nov 2011 13:43:33 +0530 Received: from d28av05.in.ibm.com (loopback [127.0.0.1]) by d28av05.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pA28DWWf010754 for ; Wed, 2 Nov 2011 19:13:32 +1100 Message-ID: <4EB0FB75.7050307@linux.vnet.ibm.com> Date: Wed, 02 Nov 2011 16:12:37 +0800 From: Mark Wu 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> In-Reply-To: <1320167638-8895-5-git-send-email-coreyb@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: Corey Bryant Cc: rmarwah@linux.vnet.ibm.com, aliguori@us.ibm.com, qemu-devel@nongnu.org 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.