From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15F87C678D4 for ; Tue, 7 Mar 2023 18:51:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233266AbjCGSvP (ORCPT ); Tue, 7 Mar 2023 13:51:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233086AbjCGSux (ORCPT ); Tue, 7 Mar 2023 13:50:53 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0988A1889 for ; Tue, 7 Mar 2023 10:38:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678214269; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UA6GVI9HVyF8oMQ333Rczj5g5DIVDiblZ9QPtMRHDjI=; b=ICDyTLDmOP/rSFJwmZU+KajEGzY8JosAOx8xHkiknygY0Bwr1Vdkma3fLwytZsaS2pS3J6 TAueSqcyWNp221EFDhuWGOu4L5bjsbptQ14BidYWCJqUxoO6KNWiSG0D1Jxo8SlZRo9q2M WAorepUHQonJ3OLdKqYzNdrS2wjPkJk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-601-gOW5cVuOOe2nvKJymIiDRw-1; Tue, 07 Mar 2023 13:31:38 -0500 X-MC-Unique: gOW5cVuOOe2nvKJymIiDRw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8E296858F0E; Tue, 7 Mar 2023 18:31:37 +0000 (UTC) Received: from RHTPC1VM0NT (unknown [10.22.32.201]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0AC9F492C18; Tue, 7 Mar 2023 18:31:37 +0000 (UTC) From: Aaron Conole To: Xin Long Cc: netfilter-devel@vger.kernel.org, network dev , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , davem@davemloft.net, kuba@kernel.org, Eric Dumazet , Paolo Abeni , Roopa Prabhu , Nikolay Aleksandrov , Pravin B Shelar Subject: Re: [PATCH nf-next 5/6] netfilter: use nf_ip6_check_hbh_len in nf_ct_skb_network_trim References: <5411027934a79f0430edb905ad4b434ec6b8396e.1677888566.git.lucien.xin@gmail.com> Date: Tue, 07 Mar 2023 13:31:31 -0500 In-Reply-To: <5411027934a79f0430edb905ad4b434ec6b8396e.1677888566.git.lucien.xin@gmail.com> (Xin Long's message of "Fri, 3 Mar 2023 19:12:41 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Xin Long writes: > For IPv6 Jumbo packets, the ipv6_hdr(skb)->payload_len is always 0, > and its real payload_len ( > 65535) is saved in hbh exthdr. With 0 > length for the jumbo packets, all data and exthdr will be trimmed > in nf_ct_skb_network_trim(). > > This patch is to call nf_ip6_check_hbh_len() to get real pkt_len > of the IPv6 packet, similar to br_validate_ipv6(). > > Signed-off-by: Xin Long > --- Reviewed-by: Aaron Conole > net/netfilter/nf_conntrack_ovs.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/net/netfilter/nf_conntrack_ovs.c b/net/netfilter/nf_conntrack_ovs.c > index 52b776bdf526..2016a3b05f86 100644 > --- a/net/netfilter/nf_conntrack_ovs.c > +++ b/net/netfilter/nf_conntrack_ovs.c > @@ -6,6 +6,7 @@ > #include > #include > #include > +#include > > /* 'skb' should already be pulled to nh_ofs. */ > int nf_ct_helper(struct sk_buff *skb, struct nf_conn *ct, > @@ -114,14 +115,20 @@ EXPORT_SYMBOL_GPL(nf_ct_add_helper); > int nf_ct_skb_network_trim(struct sk_buff *skb, int family) > { > unsigned int len; > + int err; > > switch (family) { > case NFPROTO_IPV4: > len = skb_ip_totlen(skb); > break; > case NFPROTO_IPV6: > - len = sizeof(struct ipv6hdr) > - + ntohs(ipv6_hdr(skb)->payload_len); > + len = ntohs(ipv6_hdr(skb)->payload_len); > + if (ipv6_hdr(skb)->nexthdr == NEXTHDR_HOP) { > + err = nf_ip6_check_hbh_len(skb, &len); > + if (err) > + return err; > + } > + len += sizeof(struct ipv6hdr); > break; > default: > len = skb->len;