From patchwork Tue Nov 24 10:05:04 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark McLoughlin X-Patchwork-Id: 39197 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0C8C4B7BDD for ; Tue, 24 Nov 2009 21:08:40 +1100 (EST) Received: from localhost ([127.0.0.1]:60916 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCsK5-0006Sl-GY for incoming@patchwork.ozlabs.org; Tue, 24 Nov 2009 05:08:37 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NCsJP-0006SN-UC for qemu-devel@nongnu.org; Tue, 24 Nov 2009 05:07:55 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NCsJL-0006Qo-QN for qemu-devel@nongnu.org; Tue, 24 Nov 2009 05:07:55 -0500 Received: from [199.232.76.173] (port=50761 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCsJL-0006Qk-M9 for qemu-devel@nongnu.org; Tue, 24 Nov 2009 05:07:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:13603) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NCsJL-0008CB-BK for qemu-devel@nongnu.org; Tue, 24 Nov 2009 05:07:51 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAOA7kE1012504 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 24 Nov 2009 05:07:46 -0500 Received: from [IPv6:::1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nAOA7jfU007333; Tue, 24 Nov 2009 05:07:45 -0500 From: Mark McLoughlin To: Pierre Riteau In-Reply-To: <1259053593-15362-1-git-send-email-Pierre.Riteau@irisa.fr> References: <1259053593-15362-1-git-send-email-Pierre.Riteau@irisa.fr> Date: Tue, 24 Nov 2009 10:05:04 +0000 Message-Id: <1259057104.8935.18.camel@blaa> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] net: initialize vnet_hdr in net_tap_init() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Mark McLoughlin List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Hi Pierre, On Tue, 2009-11-24 at 10:06 +0100, Pierre Riteau wrote: > vnet_hdr is initialized at 1 by default. We need to reset it to 0 if > the kernel doesn't support IFF_VNET_HDR. Thanks for the patch, but I'd prefer us to make sure we catch all cases. Does this work for you? Thanks, Mark. From: Mark McLoughlin Subject: [PATCH] net: initialize vnet_hdr in net_tap_init() Don't assume that all tap_open() implementations will set it to zero if VNET_HDR support isn't found. Fixes tap networking on host kernels lacking IFF_VNET_HDR support. Reported-by: Pierre Riteau Signed-off-by: Mark McLoughlin --- net/tap.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/tap.c b/net/tap.c index d34feec..7fb9e16 100644 --- a/net/tap.c +++ b/net/tap.c @@ -378,7 +378,7 @@ static int net_tap_init(QemuOpts *opts, int *vnet_hdr) int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan) { TAPState *s; - int fd, vnet_hdr; + int fd, vnet_hdr = 0; if (qemu_opt_get(opts, "fd")) { if (qemu_opt_get(opts, "ifname") ||