From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34552) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TZM9y-0006nB-36 for qemu-devel@nongnu.org; Fri, 16 Nov 2012 08:40:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TZM9u-0000dG-Ru for qemu-devel@nongnu.org; Fri, 16 Nov 2012 08:40:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:3504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TZM9u-0000dA-K2 for qemu-devel@nongnu.org; Fri, 16 Nov 2012 08:40:38 -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.14.4/8.14.4) with ESMTP id qAGDebcp018939 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 16 Nov 2012 08:40:38 -0500 From: Stefan Hajnoczi Date: Fri, 16 Nov 2012 14:40:06 +0100 Message-Id: <1353073206-31501-5-git-send-email-stefanha@redhat.com> In-Reply-To: <1353073206-31501-1-git-send-email-stefanha@redhat.com> References: <1353073206-31501-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PATCH 4/4] tap: reset vnet header size on open List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , "Michael S. Tsirkin" From: "Michael S. Tsirkin" For tap, we currently assume the vnet header size is 10 (the default value) but that might not be the case if tap is persistent and has been used by qemu previously. To fix, set host header size in tap device on open. Signed-off-by: Michael S. Tsirkin Signed-off-by: Stefan Hajnoczi --- net/tap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/tap.c b/net/tap.c index 7102b91..efd2bab 100644 --- a/net/tap.c +++ b/net/tap.c @@ -338,6 +338,13 @@ static TAPState *net_tap_fd_init(NetClientState *peer, s->using_vnet_hdr = 0; s->has_ufo = tap_probe_has_ufo(s->fd); tap_set_offload(&s->nc, 0, 0, 0, 0, 0); + /* + * Make sure host header length is set correctly in tap: + * it might have been modified by another instance of qemu. + */ + if (tap_probe_vnet_hdr_len(s->fd, s->host_vnet_hdr_len)) { + tap_fd_set_vnet_hdr_len(s->fd, s->host_vnet_hdr_len); + } tap_read_poll(s, 1); s->vhost_net = NULL; return s; -- 1.8.0