Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4623425imw; Tue, 12 Jul 2022 11:09:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ttGcBg6ApDNnTUCQtz6MjRtEPV18GR/EA653EJHGX8XcO6s/P+Sy+aLdathj71dqtCPV9n X-Received: by 2002:a17:907:7608:b0:72b:4f33:bcce with SMTP id jx8-20020a170907760800b0072b4f33bccemr13343762ejc.252.1657649395417; Tue, 12 Jul 2022 11:09:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657649395; cv=none; d=google.com; s=arc-20160816; b=mvG9DHfswhvbjk4nNzlEztRhMPHfjHKG4ZbJiaOmqk0/Lm5sBUQqIO2l+dF87x5Cli Ha2H+ZTP/7IUc2deuOn8wQlBnecFfT3cxaMOys2ReywA87SKZvQyWG8LgMYfUvxB7MiI F51uN3OVdXz1yb0KrQ7x1QIXT0KAGkxnS/vnw7fALdLYmFHuPrOlFVHeVmfoML5BVJvi aTRoHNSo5PrEujcKKcoGDT3IwEaFCkYJtGjJsW+2G3GepEJcmVreWsIr382DMxmsfi2B f6hUCdyqsQcQECVXCXAt3eNYjrzAUT84AAKEo4KpjsuevFpDxjIfUbM/WZ/6U/sVgjLS N7rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=w6PefaQOXkX4Y9qNNl5wjaszZlVP6yh7I9p05ee/Css=; b=DVCIRL+HRNXv40/8Af6ZRnSLp6ZRat4d+lVg0WXD6sifNqy2JGTKLseukkZBhYrxgq 3Ayo71oTB9WozdwuotexQq7JCSDcP2r6Yuttb/f/Jxw3eDed4QzfIZNfwc16VIw7FsTH 8kye+Ok9XZS5pIEcsnBW5LLiUB7YayU36hfkK9bXPGU4r/HihPMPZ19jVcjlmxl9Xp2o u5og8W0rPU4npn/ETpTXMIU3O6aj84XaVWMlfMvwCFyYpZuz8tvg6xuEDy9F+ZXTVUSh ZlwCual8+s2j0UPupaH/RxvKlKQvCu40ggp2WuKARCzur8TEWrKcqT9UkQEgnZQ1APBb kVJA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=uniroma2.it Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j20-20020a05640211d400b0043ad7970b9fsi10183352edw.192.2022.07.12.11.09.28; Tue, 12 Jul 2022 11:09:55 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=uniroma2.it Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233605AbiGLSAO (ORCPT + 99 others); Tue, 12 Jul 2022 14:00:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233462AbiGLSAG (ORCPT ); Tue, 12 Jul 2022 14:00:06 -0400 Received: from smtp.uniroma2.it (smtp.uniroma2.it [160.80.6.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1B49B93C3; Tue, 12 Jul 2022 11:00:01 -0700 (PDT) Received: from localhost.localdomain ([160.80.103.126]) by smtp-2015.uniroma2.it (8.14.4/8.14.4/Debian-8) with ESMTP id 26CHxCBr005871 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 12 Jul 2022 19:59:12 +0200 From: Andrea Mayer To: "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 Cc: Stefano Salsano , Paolo Lungaroni , Ahmed Abdelsalam , Anton Makarov , Andrea Mayer Subject: [net 0/3] seg6: fix skb checksum for SRH encapsulation/insertion Date: Tue, 12 Jul 2022 19:58:34 +0200 Message-Id: <20220712175837.16267-1-andrea.mayer@uniroma2.it> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: clamav-milter 0.100.0 at smtp-2015 X-Virus-Status: Clean X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 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) 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