From patchwork Wed May 24 17:51:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sjors Gielen X-Patchwork-Id: 766617 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wY16P6vgmz9ryT for ; Thu, 25 May 2017 04:25:33 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sjorsgielen-nl.20150623.gappssmtp.com header.i=@sjorsgielen-nl.20150623.gappssmtp.com header.b="cBcvYpy0"; dkim-atps=neutral Received: from localhost ([::1]:56277 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDayO-0000FR-BI for incoming@patchwork.ozlabs.org; Wed, 24 May 2017 14:25:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49851) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDaRT-0000BP-0I for qemu-devel@nongnu.org; Wed, 24 May 2017 13:51:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDaRS-0001mI-0D for qemu-devel@nongnu.org; Wed, 24 May 2017 13:51:27 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:35858) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dDaRR-0001lC-LE for qemu-devel@nongnu.org; Wed, 24 May 2017 13:51:25 -0400 Received: by mail-wm0-x242.google.com with SMTP id k15so47461491wmh.3 for ; Wed, 24 May 2017 10:51:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sjorsgielen-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to:cc; bh=3ZW8VIbCFOFwkncp3AIu7kYIWLEpprP2f8NADY4aSQw=; b=cBcvYpy0Hafd4AspIDNgT56wzo/rEsOJSgcS/knH4hjSScpJuelKH13SKl7sIstve3 vJoDOrGXnU6ie7F1FF1GXKaOJmH/sRBseOOv394Ng1aKHfbvK232DvSIK23x4WCrj3nW 5Y5V4FEzRsDQBr+dEXqQIY8dc2zyOlzYRNNVtZ9LkIEUxyXsW3jP1Z3slME0TjqapKu+ Lt5DTchRzMSQydZbIqPvhvcdwx/3YMCxyFfM0EX6tmqzh8eCZulHRAsjJyoXwpArIope 3G4yUc1IcuHZBW3Tn82h+98n2cWqERpDYUHjB1kiCyjWT+jIaI6sPTfhKf4LtXKjtLjK kY8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=3ZW8VIbCFOFwkncp3AIu7kYIWLEpprP2f8NADY4aSQw=; b=cng8XITkjgxH6t+tCnIVcsgiaW9qkipr4kOI53BQd8HXpl7xuTzDq9WD2WWsjbCzvd /8HvtD9heGG0Z9Z8KhtXex/iJLQ57YHmiFvBewg21l3ZgJeYXrR4FbmR2+4/o6l8e8/6 aqdkrCBurAtCRpizvyxZ55+MYNoqEZAa9b//vnVI/bHr2/c/w70yazhcKoqwAKjr6R+r XIqZp/iMZcGopHwl9QXvBIyJvJcXu0iXWkHjUZmRotal3q/hLqH2u1ggRO+/m0F0VaOr bcus0Yi5pmcIg6J9U0oEUJCd9ltrUVzzV2Os8PzYPQBSKHUOImFx20jCM4He10bCfMIz XQVQ== X-Gm-Message-State: AODbwcBPNQLCLxgi347Kp6cGn9L9JuVxfyBNOnc8ygbP32kW/f26Czu4 dL7DdxcbyDe34kM/1Jtj4B4PA+o0l8b+iAk= X-Received: by 10.28.28.146 with SMTP id c140mr7378561wmc.122.1495648283336; Wed, 24 May 2017 10:51:23 -0700 (PDT) MIME-Version: 1.0 From: Sjors Gielen Date: Wed, 24 May 2017 17:51:12 +0000 Message-ID: To: Samuel Thibault , Jan Kiszka X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 X-Mailman-Approved-At: Wed, 24 May 2017 14:25:06 -0400 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: [Qemu-devel] [PATCH] [SLIRP] Fix total IP header length in forwarded TCP packets X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" When forwarding TCP packets, the internal tcpiphdr struct length was wrongly used inside the IP header. This commit changes the behaviour to what is used by tcp_output.c, using the correct full IP header + payload length. Signed-off-by: Sjors Gielen --- slirp/tcp_subr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ip->ip_p = tcpiph_save.ti_pr; @@ -224,7 +224,7 @@ tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m, m->m_len -= sizeof(struct tcpiphdr) - sizeof(struct tcphdr) - sizeof(struct ip6); ip6 = mtod(m, struct ip6 *); - ip6->ip_pl = tlen; + ip6->ip_pl = m->m_len; ip6->ip_dst = tcpiph_save.ti_dst6; ip6->ip_src = tcpiph_save.ti_src6; ip6->ip_nh = tcpiph_save.ti_nh6; diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c index ed16e1807f..3d6193657c 100644 --- a/slirp/tcp_subr.c +++ b/slirp/tcp_subr.c @@ -204,7 +204,7 @@ tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m, m->m_len -= sizeof(struct tcpiphdr) - sizeof(struct tcphdr) - sizeof(struct ip); ip = mtod(m, struct ip *); - ip->ip_len = tlen; + ip->ip_len = m->m_len; ip->ip_dst = tcpiph_save.ti_dst; ip->ip_src = tcpiph_save.ti_src;