From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:54014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLczb-0007bt-Li for qemu-devel@nongnu.org; Wed, 02 Nov 2011 11:44:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RLcza-0006Bx-Ls for qemu-devel@nongnu.org; Wed, 02 Nov 2011 11:44:43 -0400 Received: from e8.ny.us.ibm.com ([32.97.182.138]:40340) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLcza-0006BZ-JH for qemu-devel@nongnu.org; Wed, 02 Nov 2011 11:44:42 -0400 Received: from /spool/local by e8.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 2 Nov 2011 11:44:15 -0400 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pA2FL95P223618 for ; Wed, 2 Nov 2011 11:42:05 -0400 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pA2FC9k7018510 for ; Wed, 2 Nov 2011 09:12:10 -0600 Message-ID: <4EB15DC3.2080207@linux.vnet.ibm.com> Date: Wed, 02 Nov 2011 11:12:03 -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> 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/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. Regards, Corey