From patchwork Thu Oct 29 07:04:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xin Long X-Patchwork-Id: 316072 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C033EC55179 for ; Thu, 29 Oct 2020 07:21:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 64CF8218AC for ; Thu, 29 Oct 2020 07:21:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FMzkrdpL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726275AbgJ2HVe (ORCPT ); Thu, 29 Oct 2020 03:21:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725996AbgJ2HVB (ORCPT ); Thu, 29 Oct 2020 03:21:01 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F45BC08E935; Thu, 29 Oct 2020 00:05:37 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id 15so1560971pgd.12; Thu, 29 Oct 2020 00:05:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=NWswMQFNrJpmgSXJFGyvzsyral3mRo2RUwnr9RHwTGk=; b=FMzkrdpLP8LJTwRS870cQ1c+l6LVaM3fL+0yvxGcRnBXWQyht7dRNBbjlrHAGPtEXz 1MiW4Yjpc9o/wjibwDdR4eVImAAmO4zvOWx2+mjMuxLJ6g/ZKhORI+srJmyghC3KponD KmXTT6rYqDzJGHPMRpqB1yK+4D1TwNUSLILDikGfwTnBM+gCbX5/A5yLfOFaCULf4ZHH kePH0p+ircE2q0tzoGVwTeR+CDBbgImjIITmiQUfX6GVN/kfZCV/wBiVv0KO8Y1e++Db WVUaIGEgabfZBdnK/8UITiBsOYHqYh1Jq0+RmWye0wWpxkGIQ1YWkOggSQspIx2yCSNS VFQg== 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:in-reply-to:references; bh=NWswMQFNrJpmgSXJFGyvzsyral3mRo2RUwnr9RHwTGk=; b=mH84WkJ7bWd8MOQs4v5ScgKzViIZ9ZsdRJkLc20OJzCK3OU4F6RlXNrZXg1SsAPBMF KJGFIun1x+myjIf0MNx0WOpXUjWnM4Uq2yhqkZC34TBgUaQ8Qk5k2I2z+8rCxyImVYPE XijH/wjG8fbJeAgizKvGvHyoiobLKn8xevLwuQ5AF3PmlQnMZkr4e8SsRhCc0iExRe2T fAOj7m3qpTOD3ssalneBghR81CGhZ0zgBMmy8vjw3aC2oETVr3mIt+MFH6mv2bREnRFY LVPMK9+wre322nZfpN/OUuJBcJaKEjaOX5r4NTNoaiX4RlSSja9OiJhfJvLRVxkM33EA 7ukQ== X-Gm-Message-State: AOAM531jWn1UqTcb1ltX4Qck7NAzGucizgfJQrTYz5Xq6c8hIGgRYTCS uOHiLNEP7oiwD/cHU1n+EGXnRuzA9L0= X-Google-Smtp-Source: ABdhPJzStPrIlge1Q43JVmvhe1k1tol7OuaYSsrqLtqxO8Nk1ZkijtrrkUoYoO/WtG02W5s9k8PO5Q== X-Received: by 2002:a17:90a:7024:: with SMTP id f33mr2889200pjk.114.1603955136359; Thu, 29 Oct 2020 00:05:36 -0700 (PDT) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id g1sm1713226pjj.3.2020.10.29.00.05.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Oct 2020 00:05:35 -0700 (PDT) From: Xin Long To: network dev , linux-sctp@vger.kernel.org Cc: Marcelo Ricardo Leitner , Neil Horman , Michael Tuexen , davem@davemloft.net, Jakub Kicinski , gnault@redhat.com, pabeni@redhat.com, willemdebruijn.kernel@gmail.com Subject: [PATCHv5 net-next 02/16] udp6: move the mss check after udp gso tunnel processing Date: Thu, 29 Oct 2020 15:04:56 +0800 Message-Id: <4f439ed717442a649ba78dc0efc6f121208a9995.1603955040.git.lucien.xin@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <48053c3bf48a46899bc0130dc43adca1e6925581.1603955040.git.lucien.xin@gmail.com> References: <48053c3bf48a46899bc0130dc43adca1e6925581.1603955040.git.lucien.xin@gmail.com> In-Reply-To: References: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org For some protocol's gso, like SCTP, it's using GSO_BY_FRAGS for gso_size. When using UDP to encapsulate its packet, it will return error in udp6_ufo_fragment() as skb->len < gso_size, and it will never go to the gso tunnel processing. So we should move this check after udp gso tunnel processing, the same as udp4_ufo_fragment() does. v1->v2: - no change. v2->v3: - not do any cleanup. Signed-off-by: Xin Long --- net/ipv6/udp_offload.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c index 584157a..aa602af 100644 --- a/net/ipv6/udp_offload.c +++ b/net/ipv6/udp_offload.c @@ -28,10 +28,6 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, int tnl_hlen; int err; - mss = skb_shinfo(skb)->gso_size; - if (unlikely(skb->len <= mss)) - goto out; - if (skb->encapsulation && skb_shinfo(skb)->gso_type & (SKB_GSO_UDP_TUNNEL|SKB_GSO_UDP_TUNNEL_CSUM)) segs = skb_udp_tunnel_segment(skb, features, true); @@ -48,6 +44,10 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) return __udp_gso_segment(skb, features); + mss = skb_shinfo(skb)->gso_size; + if (unlikely(skb->len <= mss)) + goto out; + /* Do software UFO. Complete and fill in the UDP checksum as HW cannot * do checksum of UDP packets sent as multiple IP fragments. */