From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:36899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLx4q-0000C4-TL for qemu-devel@nongnu.org; Thu, 03 Nov 2011 09:11:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RLx4j-0000xR-KR for qemu-devel@nongnu.org; Thu, 03 Nov 2011 09:11:28 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:46982) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLx4j-0000xL-Hs for qemu-devel@nongnu.org; Thu, 03 Nov 2011 09:11:21 -0400 Received: from /spool/local by e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 3 Nov 2011 09:11:21 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pA3DBISZ291716 for ; Thu, 3 Nov 2011 09:11:18 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pA3DBEpS024008 for ; Thu, 3 Nov 2011 11:11:14 -0200 Message-ID: <4EB292EE.5020804@linux.vnet.ibm.com> Date: Thu, 03 Nov 2011 09:11:10 -0400 From: Corey Bryant MIME-Version: 1.0 References: <1320167638-8895-1-git-send-email-coreyb@linux.vnet.ibm.com> <1320167638-8895-2-git-send-email-coreyb@linux.vnet.ibm.com> <4EB15DC3.2080207@linux.vnet.ibm.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 1/4] Add basic version of bridge helper List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: rmarwah@linux.vnet.ibm.com, aliguori@us.ibm.com, qemu-devel@nongnu.org On 11/03/2011 03:54 AM, Stefan Hajnoczi wrote: > On Wed, Nov 2, 2011 at 3:12 PM, Corey Bryant wrote: >> On 11/02/2011 06:58 AM, Stefan Hajnoczi wrote: >>> >>> On Tue, Nov 1, 2011 at 5:13 PM, Corey Bryant >>> wrote: >>>> >>>> +static bool has_vnet_hdr(int fd) >>>> +{ >>>> + unsigned int features = 0; >>>> + struct ifreq ifreq; >>>> + >>>> + if (ioctl(fd, TUNGETFEATURES,&features) == -1) { >>>> + return false; >>>> + } >>>> + >>>> + if (!(features& IFF_VNET_HDR)) { >>>> + return false; >>>> + } >>>> + >>>> + if (ioctl(fd, TUNGETIFF,&ifreq) != -1 || errno != EBADFD) { >>>> + return false; >>>> + } >>> >>> I don't understand this expression. We want TUNGETIFF to fail with >>> EBADFD, otherwise we return false. What is this trying to do? >>> >>> Why do we even need TUNGETIFF after TUNGETFEATURES succeeded and we >>> were able to check out the IFF_VNET_HDR flag? >>> >>> Stefan >>> >> >> I don't think the TUNGETIFF call is necessary. It verifies that the tap >> device doesn't already exist. The ensuing TUNSETIFF call should already >> cover this. > > Thanks for explaining. It would be nice to comment this or drop the > if statement entirely if you are sending another revision of this > patch series. > > Stefan > You're welcome, and thanks for the comment. I'll drop this if statement in the next version of the patch series. Regards, Corey