Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2909846yba; Mon, 22 Apr 2019 15:30:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZoJmnw7uX1fnQJ8g8VjotD04wrdAbzawcbvr4uzhEmFO3Qc78MJDzDxbeKe0dVg87zVnE X-Received: by 2002:a17:902:a98b:: with SMTP id bh11mr22569141plb.63.1555972254540; Mon, 22 Apr 2019 15:30:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555972254; cv=none; d=google.com; s=arc-20160816; b=AXEK2U3Ljs1W/aVdXA2dtd+ZEXDDxYIDsx5ADskSDiVTf5s28QL1PvmsaAASZn43Ez rlpJgYcU4Han7gzyotKka++8/awzM3JdazAz8cxpywSEEUzqYwzrisif1KCz3z4Rzrnh P6Twh2NuSV5i2M3RXdDvyxpHZ742FfquoJbNdB56yE1SL/Fs8mSLB9P+3mWEgMc1h5rj W3PLToDGTY4b0WWutYIBze3oTZ468rVn6H5SHO6wcybHWpG3NUc0V2d8UhDFbkPSqocp cBdkRC946DX9oIedQLPT+F2QindnAiBlp0JjCy0JNxkMdWFOvFw3F+KRb4B2BBX2Fq6X 5hUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3u3mLbg8haSkSa9aDmaPiZaDvuuoT42PdZUYWFXZdrw=; b=wCLT6q8+MYACW2YbYtN97QKEPUO+JIpxm6AA/Bva+0axxGxKopnUjXcfuCQPaaGzDY YGaJYBDdrI36ZE4AHvApPAsu6TJjOpi0IFjTO/KeJk8yR8DOXoKZn1sLPCPS1j2rFBLS G/tIjLOQtcoz3eucmYrYGh/RODcVFVLg2o7Qxurihr4P2vwa1dAPcflKKXYigtc55utp PfxdqrvryqKxrNpW276HjTLWtpZyjSO/mWPVpGGGh3aBUdz734a3upz3PNysE0ixErWE ZvZGFjHSADmGkjW9Thfkxm3BiXNDon9tRPtH7zeSP28NyzwWHKciwPyHClqoMvV/BAHB 44AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OTxkAxAB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m6si12851234pgq.116.2019.04.22.15.30.38; Mon, 22 Apr 2019 15:30:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OTxkAxAB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729838AbfDVTpn (ORCPT + 99 others); Mon, 22 Apr 2019 15:45:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:47456 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729809AbfDVTpj (ORCPT ); Mon, 22 Apr 2019 15:45:39 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C5856218B0; Mon, 22 Apr 2019 19:45:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555962338; bh=sq0eE+VglM/+8TvJTi376HaUowcFk2K39SDElKrQABA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OTxkAxABhgP3ItnX4opP6TElhSOCJrzH5W3uYyVVtreyl0SFLlCk0Fs5UUjPLyug1 5On9/BQcUMoyrCia5eM7jg8+d9mEhyuAkKJjywdq/LPxUR9KH84mUsUuBZN+aYQTUq g2g1nngnVleCVhE85OwDrecGYNT6hsxpI0SpNSLA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Xin Long , Pablo Neira Ayuso , Sasha Levin , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 11/68] netfilter: bridge: set skb transport_header before entering NF_INET_PRE_ROUTING Date: Mon, 22 Apr 2019 15:44:19 -0400 Message-Id: <20190422194516.11634-11-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190422194516.11634-1-sashal@kernel.org> References: <20190422194516.11634-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xin Long [ Upstream commit e166e4fdaced850bee3d5ee12a5740258fb30587 ] Since Commit 21d1196a35f5 ("ipv4: set transport header earlier"), skb->transport_header has been always set before entering INET netfilter. This patch is to set skb->transport_header for bridge before entering INET netfilter by bridge-nf-call-iptables. It also fixes an issue that sctp_error() couldn't compute a right csum due to unset skb->transport_header. Fixes: e6d8b64b34aa ("net: sctp: fix and consolidate SCTP checksumming code") Reported-by: Li Shuang Suggested-by: Pablo Neira Ayuso Signed-off-by: Xin Long Acked-by: Neil Horman Acked-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin (Microsoft) --- net/bridge/br_netfilter_hooks.c | 1 + net/bridge/br_netfilter_ipv6.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c index 3b0a03b92080..212c184c1eee 100644 --- a/net/bridge/br_netfilter_hooks.c +++ b/net/bridge/br_netfilter_hooks.c @@ -515,6 +515,7 @@ static unsigned int br_nf_pre_routing(void *priv, nf_bridge->ipv4_daddr = ip_hdr(skb)->daddr; skb->protocol = htons(ETH_P_IP); + skb->transport_header = skb->network_header + ip_hdr(skb)->ihl * 4; NF_HOOK(NFPROTO_IPV4, NF_INET_PRE_ROUTING, state->net, state->sk, skb, skb->dev, NULL, diff --git a/net/bridge/br_netfilter_ipv6.c b/net/bridge/br_netfilter_ipv6.c index 5811208863b7..09d5e0c7b3ba 100644 --- a/net/bridge/br_netfilter_ipv6.c +++ b/net/bridge/br_netfilter_ipv6.c @@ -235,6 +235,8 @@ unsigned int br_nf_pre_routing_ipv6(void *priv, nf_bridge->ipv6_daddr = ipv6_hdr(skb)->daddr; skb->protocol = htons(ETH_P_IPV6); + skb->transport_header = skb->network_header + sizeof(struct ipv6hdr); + NF_HOOK(NFPROTO_IPV6, NF_INET_PRE_ROUTING, state->net, state->sk, skb, skb->dev, NULL, br_nf_pre_routing_finish_ipv6); -- 2.19.1