From patchwork Tue Sep 27 09:20:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 116555 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 148A6B6F72 for ; Tue, 27 Sep 2011 19:21:01 +1000 (EST) Received: from localhost ([::1]:55429 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8TqM-0005PJ-DK for incoming@patchwork.ozlabs.org; Tue, 27 Sep 2011 05:20:50 -0400 Received: from eggs.gnu.org ([140.186.70.92]:46310) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8TqH-0005PB-4a for qemu-devel@nongnu.org; Tue, 27 Sep 2011 05:20:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R8TqF-0008As-Tx for qemu-devel@nongnu.org; Tue, 27 Sep 2011 05:20:45 -0400 Received: from mtagate1.uk.ibm.com ([194.196.100.161]:60175) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8TqF-0008Ah-HP for qemu-devel@nongnu.org; Tue, 27 Sep 2011 05:20:43 -0400 Received: from d06nrmr1806.portsmouth.uk.ibm.com (d06nrmr1806.portsmouth.uk.ibm.com [9.149.39.193]) by mtagate1.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p8R9KfHX016993 for ; Tue, 27 Sep 2011 09:20:41 GMT Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by d06nrmr1806.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p8R9KeLX2240696 for ; Tue, 27 Sep 2011 10:20:40 +0100 Received: from d06av01.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p8R9KdAf019494 for ; Tue, 27 Sep 2011 03:20:39 -0600 Received: from BR8GGW75.de.ibm.com (dyn-9-152-221-25.boeblingen.de.ibm.com [9.152.221.25]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p8R9Kdpw019475; Tue, 27 Sep 2011 03:20:39 -0600 Date: Tue, 27 Sep 2011 11:20:38 +0200 From: Thomas Huth To: qemu-devel@nongnu.org Message-ID: <20110927112038.42b5b3f8@BR8GGW75.de.ibm.com> Organization: IBM X-Mailer: Claws Mail 3.7.4 (GTK+ 2.20.1; i486-pc-linux-gnu) Mime-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 194.196.100.161 Cc: Jan Kiszka , Fabien Chouteau Subject: [Qemu-devel] [PATCH] slirp: Fix packet expiration X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The two new variables "arp_requested" and "expiration_date" in the mbuf structure have been added after the variable-sized "m_dat_" array. The variables have to be added before the m_dat_ array instead. Without this patch, the expiration_date gets clobbered by code that accesses the m_dat_ array. I experienced this problem with the code in slirp/tftp.c: The tftp_send_data() function created a new packet with the m_get() function (which fills-in a default expiration_date value). Then the TFTP code cleared the data section of the packet, which accidentially also cleared the expiration_date. This zeroed expiration_date then finally causes the packet to be discarded during if_start(), so that TFTP packets were not transmitted anymore. Signed-off-by: Thomas Huth ------- slirp/mbuf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slirp/mbuf.h b/slirp/mbuf.h index 55170e5..37b9dbb 100644 --- a/slirp/mbuf.h +++ b/slirp/mbuf.h @@ -82,12 +82,12 @@ struct m_hdr { struct mbuf { struct m_hdr m_hdr; Slirp *slirp; + bool arp_requested; + uint64_t expiration_date; union M_dat { char m_dat_[1]; /* ANSI don't like 0 sized arrays */ char *m_ext_; } M_dat; - bool arp_requested; - uint64_t expiration_date; }; #define m_next m_hdr.mh_next