Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp109581imw; Tue, 12 Jul 2022 15:42:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vHmADQGexULdhLsB/CfOym+oUyp6hXu476VcLok5zve/6IPeI11ol2w5QygMA1/Znv7Qbm X-Received: by 2002:a17:902:e547:b0:16c:1ee:262f with SMTP id n7-20020a170902e54700b0016c01ee262fmr497750plf.130.1657665766531; Tue, 12 Jul 2022 15:42:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657665766; cv=none; d=google.com; s=arc-20160816; b=yHA2Qtm3XwsnO/jnJ1o09tIzPJ/Chv9b/rb9c7yrd0AleW2yhK9wimKzFpZS176WKl qdmky9DoUvN2bBC15Lzb8gCi8ysdigOfPdTsl97+ilD/mj/22AgmArcSI/Sc6aRzfKKf xVKIdessUEy2T+H79qgo0DlG/WHhFQgm7yN4kk82Pl/9wf8iEuINwxrMnx+ypdU8cogJ JxigJR+K1JBY58b627uqJI+IgLumGnu+zVjbTo0aQ4qLqiiPKad1Cxi1fAJZRaaszhHC XAVYmll5QruXhN7lJqpLV1MGQ9ixPP+rT+0T6MeUatWqZPU/x489KqgoqkyDuICGz4We TlfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=y6t3iDm9GwNmjV2vlQyhKcUiXb93GbH2Nv8sz+9x1PM=; b=pZCNJWSFGtm51+tFnb8nwOS0LIr+lp6jpBNd9DLDPYxo8Uv0R4RYlJ4tkiUox4AxeQ 9kvbHXl7CBMkiSm2M3p99GO+jbWh1RklasqNeHgVxpfjaphRv6SE71uSP2rNljuGLhyr j6ZCN03ZhwI5zu4WJq6eM9SP0gGhNS4PeXqMFsH4JqhZ9IBi7tsaTOaksUXTC+7vaV7x yruxTRRssSdK7mGc8DJsVo2SqrT44H50uzIyfoqhRRTqWuMWS3yTxqjrzWOQD/BlKxcn 6L4FZbbjYoa/YgGce2mEqMQSWZPjTPOEWwUBUA3oQ5klbK/T7C2SCbO84R49AujeVO4F 5e4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=L+JGxUqk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b4-20020a056a000cc400b00525576117fbsi15869421pfv.360.2022.07.12.15.42.10; Tue, 12 Jul 2022 15:42:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=L+JGxUqk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232094AbiGLWO4 (ORCPT + 99 others); Tue, 12 Jul 2022 18:14:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229933AbiGLWOx (ORCPT ); Tue, 12 Jul 2022 18:14:53 -0400 Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15693AE3BE for ; Tue, 12 Jul 2022 15:14:52 -0700 (PDT) Received: by mail-pj1-x104a.google.com with SMTP id mm6-20020a17090b358600b001ef7bd409b0so4321179pjb.8 for ; Tue, 12 Jul 2022 15:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=y6t3iDm9GwNmjV2vlQyhKcUiXb93GbH2Nv8sz+9x1PM=; b=L+JGxUqk+x+Rvv1+JcEOnvYuGWypPqnYlFtTwCDRfh7+XIaQder6grPJXbYeqAtZBE Pv9osdMol+o8TKB8+Vr3YUJCD1oUKozPs3Xam6Dy8HQyRb/5dMrg0CeWCW7R+Qt4CXJM lFZn5r+oeVG0Gu8FGv5TASPc2LVFtPrlDTOidqIj7rgm1oJjTjHet/kWj2pUtUlMtsW0 0BKehu2K0h0Bfhx/DqvdzmJqktJiAOb3/V8/UI2UDZBmL6uuBPTZTWFoOdNexBeKCIKH 8G+aplAjz1F3qSeVgDkgeYY8m3Jz7xe5mVQn2XJv8DOxSqQ6dLScs2KZozyuhATYISes C7lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=y6t3iDm9GwNmjV2vlQyhKcUiXb93GbH2Nv8sz+9x1PM=; b=SFbwXfeVyNTreqam3dSGmJRCLypF5QRCnoW+whZOCjfEgZoNkrnpq+cCbD62I25Sb8 IrnUQEXciID9YvqXgnBhU0l6qX0xE7vE6mh9xlDUBqbZEYVyFGY60+fdJziCU5CkitHS 2P7ZZr5kOwpTxFPC4ZkGHQCrCepfGiwqgpUNZi0/hLR+WurMdhNkN+6Qq3iv7vEnUuLv 777K0S9XilDOfTLqomzV0KVtZqZ5lsjbpp15Vh2+gxfpheefucSW4tdSsWXSIKUB5Xjq L/C1h2CU07f0dl3C1Mrs8XwqjdZ4g/FTkss4aB16qClohcgiprjZjZflMnfouzpjR3w8 039A== X-Gm-Message-State: AJIora9DejqkQ2IpUh+Zl08piIAXE2NWZrRaefsy00nyV5BEgQv8urWl 5nI7OA0HxpN5jVHL8UkYgFarA6c= X-Received: from sdf.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5935]) (user=sdf job=sendgmr) by 2002:a17:902:e80a:b0:16c:3e68:bbe1 with SMTP id u10-20020a170902e80a00b0016c3e68bbe1mr148045plg.85.1657664091611; Tue, 12 Jul 2022 15:14:51 -0700 (PDT) Date: Tue, 12 Jul 2022 15:14:50 -0700 In-Reply-To: <20220712175837.16267-1-andrea.mayer@uniroma2.it> Message-Id: Mime-Version: 1.0 References: <20220712175837.16267-1-andrea.mayer@uniroma2.it> Subject: Re: [net 0/3] seg6: fix skb checksum for SRH encapsulation/insertion From: sdf@google.com To: Andrea Mayer Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Hideaki YOSHIFUJI , David Ahern , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , David Lebrun , Mathieu Xhonneux , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Stefano Salsano , Paolo Lungaroni , Ahmed Abdelsalam , Anton Makarov Content-Type: text/plain; charset="UTF-8"; format=flowed; delsp=yes X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/12, Andrea Mayer wrote: > The Linux kernel supports Segment Routing Header (SRH) > encapsulation/insertion operations by providing the capability to: i) > encapsulate a packet in an outer IPv6 header with a specified SRH; ii) > insert a specified SRH directly after the IPv6 header of the packet. > Note that the insertion operation is also referred to as 'injection'. > The two operations are respectively supported by seg6_do_srh_encap() and > seg6_do_srh_inline(), which operate on the skb associated to the packet as > needed (e.g. adding the necessary headers and initializing them, while > taking care to recalculate the skb checksum). > seg6_do_srh_encap() and seg6_do_srh_inline() do not initialize the payload > length of the IPv6 header, which is carried out by the caller functions. > However, this approach causes the corruption of the skb checksum which > needs to be updated only after initialization of headers is completed > (thanks to Paolo Abeni for detecting this issue). > The patchset fixes the skb checksum corruption by moving the IPv6 header > payload length initialization from the callers of seg6_do_srh_encap() and > seg6_do_srh_inline() directly into these functions. > This patchset is organized as follows: > - patch 1/3, seg6: fix skb checksum evaluation in SRH > encapsulation/insertion; > (* SRH encapsulation/insertion available since v4.10) > - patch 2/3, seg6: fix skb checksum in SRv6 End.B6 and End.B6.Encaps > behaviors; > (* SRv6 End.B6 and End.B6.Encaps behaviors available since v4.14) > - patch 3/3, seg6: bpf: fix skb checksum in bpf_push_seg6_encap(); > (* bpf IPv6 Segment Routing helpers available since v4.18) BPF changes make sense. I've tested them by applying the whole series and running test_lwt_seg6local.sh. Reviewed-by: Stanislav Fomichev Tested-by: Stanislav Fomichev > Thank you all, > Andrea > Andrea Mayer (3): > seg6: fix skb checksum evaluation in SRH encapsulation/insertion > seg6: fix skb checksum in SRv6 End.B6 and End.B6.Encaps behaviors > seg6: bpf: fix skb checksum in bpf_push_seg6_encap() > net/core/filter.c | 1 - > net/ipv6/seg6_iptunnel.c | 5 ++++- > net/ipv6/seg6_local.c | 2 -- > 3 files changed, 4 insertions(+), 4 deletions(-) > -- > 2.20.1