Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp3246288ybh; Mon, 16 Mar 2020 19:06:30 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtYFPychN3qY2XroZ72s2ShJVGuoqmQMaX8tRVQPIKP/GDydwXZCxpdBqEQ6/OWgfn5OZ0+ X-Received: by 2002:a9d:138:: with SMTP id 53mr1835234otu.67.1584410790758; Mon, 16 Mar 2020 19:06:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584410790; cv=none; d=google.com; s=arc-20160816; b=cx0rPI49WGkHKr3bfBPUic2J5zPdAmURsroPoeAjTufGIXzt0vAbGG9MiNOetcdBy1 BfL+/ar2JfKD4cLKTyJ6sYigK+oFeYnEBj5vzRQA8Eg5PQINLVYIviOaaNTYERQM630f d0ClqcpO4XBCwnZ4NGc+rd/ramazI1yQ8vJ6K/a4a75vaVV/om8iaKMeTa1lXLz/W2Bv 7vXsg25wdHYWIzeQAySMtRbz5mD/xcIVCN59HX+fA6Ushf3AQX40T0atIhWreszY0Mkw IUAZlIhJDe5mSCgorfYzJiV0EtaZgYn9QCbLiN4uCIm5pmDdEVgdxRXtft1WgPg9ckie 7+tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=4bgM+etfxNjBTSDNFzaCyORMC7l7Jitr5RdSGXJjFdU=; b=pTztPAYs+AiqH/8ttg7UOSHGggJ1q5gmbAzvgTAHk2TOHrt5cWkLQWoUsoPEijO3XQ KdsbR/ZjICYoyKNVPe9VliNPbMBwA9TwcvvyTjc1eXTfLAN0ZEXOvTu0ymnve5/YcwHD 4wDtnvQOut91ld2MTvQ5zH8yqlkkzRK80B9Hf2QMxbofueB3098RYckfQMQmmaG7BEKo MBiimZwmHBMASwq16LUH9MITfwcQUQl+PJoxbNmO3dZSRnQylENTtc54AzZsTWadQFnX U6X2SK4Zt/rsOH09d9XgFYm9bgAT1fc+qX6pRnP8I0JCocwFWDWVjf9GTNdI6NL29caC SIsA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d12si887352oic.26.2020.03.16.19.06.18; Mon, 16 Mar 2020 19:06:30 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726399AbgCQCEp (ORCPT + 99 others); Mon, 16 Mar 2020 22:04:45 -0400 Received: from cmccmta2.chinamobile.com ([221.176.66.80]:3534 "EHLO cmccmta2.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725783AbgCQCEp (ORCPT ); Mon, 16 Mar 2020 22:04:45 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.1]) by rmmx-syy-dmz-app05-12005 (RichMail) with SMTP id 2ee55e702fde376-ec129; Tue, 17 Mar 2020 10:03:10 +0800 (CST) X-RM-TRANSID: 2ee55e702fde376-ec129 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost (unknown[223.105.0.241]) by rmsmtp-syy-appsvr01-12001 (RichMail) with SMTP id 2ee15e702fdd10e-ec706; Tue, 17 Mar 2020 10:03:10 +0800 (CST) X-RM-TRANSID: 2ee15e702fdd10e-ec706 From: Haishuang Yan To: Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal Cc: netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Haishuang Yan Subject: [PATCH v2 2/2] netfilter: nf_flow_table: reload ip{v6}h in nf_flow_tuple_ip{v6} Date: Tue, 17 Mar 2020 10:02:53 +0800 Message-Id: <1584410573-6812-2-git-send-email-yanhaishuang@cmss.chinamobile.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1584410573-6812-1-git-send-email-yanhaishuang@cmss.chinamobile.com> References: <1584410573-6812-1-git-send-email-yanhaishuang@cmss.chinamobile.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since pskb_may_pull may change skb->data, so we need to reload ip{v6}h at the right place. Fixes: a908fdec3dda ("netfilter: nf_flow_table: move ipv6 offload hook code to nf_flow_table") Fixes: 7d2086871762 ("netfilter: nf_flow_table: move ipv4 offload hook code to nf_flow_table") Signed-off-by: Haishuang Yan --- v2: collapse the patches --- net/netfilter/nf_flow_table_ip.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c index 942bda5..610c60a 100644 --- a/net/netfilter/nf_flow_table_ip.c +++ b/net/netfilter/nf_flow_table_ip.c @@ -190,6 +190,7 @@ static int nf_flow_tuple_ip(struct sk_buff *skb, const struct net_device *dev, if (!pskb_may_pull(skb, thoff + sizeof(*ports))) return -1; + iph = ip_hdr(skb); ports = (struct flow_ports *)(skb_network_header(skb) + thoff); tuple->src_v4.s_addr = iph->saddr; @@ -452,6 +453,7 @@ static int nf_flow_tuple_ipv6(struct sk_buff *skb, const struct net_device *dev, if (!pskb_may_pull(skb, thoff + sizeof(*ports))) return -1; + ip6h = ipv6_hdr(skb); ports = (struct flow_ports *)(skb_network_header(skb) + thoff); tuple->src_v6 = ip6h->saddr; -- 1.8.3.1