From patchwork Wed Nov 8 22:53:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev\" via" X-Patchwork-Id: 10049601 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DCA86601EB for ; Wed, 8 Nov 2017 22:54:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE46D2A561 for ; Wed, 8 Nov 2017 22:54:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C31062A678; Wed, 8 Nov 2017 22:54:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 597372A561 for ; Wed, 8 Nov 2017 22:54:53 +0000 (UTC) Received: from localhost ([::1]:34256 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCZFC-0005K5-AP for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Nov 2017 17:54:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59870) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCZEF-0005Jz-RP for qemu-devel@nongnu.org; Wed, 08 Nov 2017 17:53:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCZEF-0007fg-6Y for qemu-devel@nongnu.org; Wed, 08 Nov 2017 17:53:51 -0500 Received: from mail-it0-x244.google.com ([2607:f8b0:4001:c0b::244]:55121) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eCZEF-0007f8-1E for qemu-devel@nongnu.org; Wed, 08 Nov 2017 17:53:51 -0500 Received: by mail-it0-x244.google.com with SMTP id 72so8475476itk.3 for ; Wed, 08 Nov 2017 14:53:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sxoqlkYnAsEZLtwOLk3+Vowqzw8SVu8uzMzEy5LWjqY=; b=CC2IYtpisznBo+OrFrC5GdWDSjQbZXmGiETfdlfwRvLFsW3w5GpK+bkBp13sZn5PME skz8bq6CZmdYKpeqYYgb4tPJMGXZ3iOkFfpB3fu8ZFfO7W9erTlYzcbZRQUoWBDt4ToJ TGbTl2C8G37jsAcc81JqGyFRFRHTuPhcqRzhV2TUTtOFmRAOCAOdRDj6lHuSn01jOoqQ Wqa4lorNv/sgqqjSPTMATwX7ZO1Ltm0mkMF2uy3a2nSDU+ff6qV4BJz6/ZyzvtOaGf12 K087YTs3+CQGFAC1NdfWK01oiVuS5nMITQO3QCkC9u1PWVlxNC0Z7iwuH1xYIAOkRi2x OjwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sxoqlkYnAsEZLtwOLk3+Vowqzw8SVu8uzMzEy5LWjqY=; b=cWjP050lNJg96HBwIrTUAqQkRoWfmhhSSIVwY12RgpiyxchVLoszRfCpWaYx3DrUoB gVi8xVbC/T/2leqEqXozwSS7OzVzy88VnjRY2C4VtjVetXmanf/oY4/LRGcvq0SKG5e0 WcYLzWlIu03WEYktKTgDbf4MIMSgSDVrM5AXRK1wfBOibj2PTI5n4I+PNEVZ3VwND7wi AiRJbUSMyT17Mrp/RybHmJNlWBfUUhQMe73vtRJ55v3FE/4N6FlSjxd72fN8/DN6OgXv yYAzdiXtPt6rg33DhYDfCdYtVGfChoFGPlGN+yMNPd2ihgKzuOoxJQkTGc0CKYcDxlBV DsAw== X-Gm-Message-State: AJaThX7Pwxg563ztzdPocPO8mYrw5NK3U9PptE7IWvoeqOQ0xLDzwT0Z ryhp2gVCYzj3H6T1+7ueuyXP8Q== X-Google-Smtp-Source: ABhQp+RlgMKRuxRavuXwjrO7cgGZxuqIV6EEAoqflmLdtJef2gZ2igIX4SV3/MU1i57JYWypu8Jhfw== X-Received: by 10.36.236.68 with SMTP id g65mr2866730ith.78.1510181629699; Wed, 08 Nov 2017 14:53:49 -0800 (PST) Received: from paxos.mtv.corp.google.com ([2620:0:1000:1611:7567:9b12:9a7b:9aa0]) by smtp.gmail.com with ESMTPSA id a29sm2810997itj.8.2017.11.08.14.53.48 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Nov 2017 14:53:48 -0800 (PST) To: qemu-devel@nongnu.org Date: Wed, 8 Nov 2017 14:53:40 -0800 Message-Id: <20171108225340.10194-1-lepton@google.com> X-Mailer: git-send-email 2.15.0.448.gf294e3d99a-goog In-Reply-To: <20170508195404.j33kcmqncrb7fziv@var.youpi.perso.aquilenet.fr> References: <20170508195404.j33kcmqncrb7fziv@var.youpi.perso.aquilenet.fr> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c0b::244 Subject: [Qemu-devel] [PATCH] slirp: don't zero ti_i since we access it later. 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: , X-Patchwork-Original-From: Tao Wu via Qemu-devel From: "Denis V. Lunev\" via" Reply-To: Tao Wu Cc: samuel.thibault@gnu.org, Tao Wu Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The current code looks buggy, we zero ti_i while we access ti_dst/ti_src later. Signed-off-by: Tao Wu --- slirp/tcp_subr.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c index dc8b4bbb50..da0d53743f 100644 --- a/slirp/tcp_subr.c +++ b/slirp/tcp_subr.c @@ -148,7 +148,16 @@ tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m, m->m_data += IF_MAXLINKHDR; *mtod(m, struct tcpiphdr *) = *ti; ti = mtod(m, struct tcpiphdr *); - memset(&ti->ti, 0, sizeof(ti->ti)); + switch (af) { + case AF_INET: + ti->ti.ti_i4.ih_x1 = 0; + break; + case AF_INET6: + ti->ti.ti_i6.ih_x1 = 0; + break; + default: + g_assert_not_reached(); + } flags = TH_ACK; } else { /*