Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4639661imw; Tue, 12 Jul 2022 11:29:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vU8rws5fPjRyZzzV82lLGNtK17b3mITFc3/B+FdNyb9VB6zS+UEwB7TeEA5r/OCjp1d9xE X-Received: by 2002:a17:90b:4b4a:b0:1ef:fc95:3c4f with SMTP id mi10-20020a17090b4b4a00b001effc953c4fmr5680581pjb.138.1657650577026; Tue, 12 Jul 2022 11:29:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657650577; cv=none; d=google.com; s=arc-20160816; b=OND47kuNroXN1whCv23GoAJCH/IXxOld19QiOwCRX5+v/+TPS5gbkcaYmKO86GYCes 8exRLwfgd7Xf0/+vunHfn//e0kHiyYZdFnAJQRMdzcqR8ftswauor38aSVz26juPIoZp /bpNYaY3X1lwy6SY9tns6DRb6GznvN2RPbJqZznxAJtd3WqfS4CvkKaa955o9Q9aqc/b nK8MNb1chu9nTwuqmgIIQKRRxMcq6lb9vvLVkZWNraZfIdqQOdqyrdmSjq3achQZyTFm eQDXomDYjfq3BA2MNxu67wT3Th6s1m7Iap6e2sEl7NFWPqF8ciMVNihq+hcOCYOTdtQg /bHA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=sca0lmxx6hDIE3O2Wq3VC8Szv+4jKYHJNlvV/NmaFfI=; b=nPdSs32vLrRJ1cxup1B/Hp2zNbxY9ioSmvby9b73MBz4jaJB2Yb+pLiTCZVVT/NkXx Kc0mFfeGV0wdlhzJGA9URjEpumYzoY3xz/FapZKLFaJU/o8Hst7hvm1FkQJehzcGrVL6 7mWmLf5G8YiT9AFIy72bpe1yZ0fDCILTalmX6YryMKyR7EzApfPrxuFPQWBZRFXMtT3x QOPnjdtf/ZS67w3mZyOKx7GDF8XkWC/kTe8RCpYlDJXENiO+ocx1RPSEx3N4VKUa1IqF 2HTwPFVL04bPLhNtUNYgevVyLtTLWixFFs6l4EmQVLoZqQMwGRZcZ8MSRh18jz1yRBfx ICCQ== 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 a190-20020a6390c7000000b004114724c4c6si13438748pge.444.2022.07.12.11.29.22; Tue, 12 Jul 2022 11:29:37 -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 S233517AbiGLSAL (ORCPT + 99 others); Tue, 12 Jul 2022 14:00:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232488AbiGLSAG (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 A799BB93C1; 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 26CHxCBt005871 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 12 Jul 2022 19:59:14 +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 2/3] seg6: fix skb checksum in SRv6 End.B6 and End.B6.Encaps behaviors Date: Tue, 12 Jul 2022 19:58:36 +0200 Message-Id: <20220712175837.16267-3-andrea.mayer@uniroma2.it> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220712175837.16267-1-andrea.mayer@uniroma2.it> References: <20220712175837.16267-1-andrea.mayer@uniroma2.it> 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 SRv6 End.B6 and End.B6.Encaps behaviors rely on functions seg6_do_srh_{encap,inline}() to, respectively: i) encapsulate the packet within an outer IPv6 header with the specified Segment Routing Header (SRH); ii) insert the specified SRH directly after the IPv6 header of the packet. This patch removes the initialization of the IPv6 header payload length from the input_action_end_b6{_encap}() functions, as it is now handled properly by seg6_do_srh_{encap,inline}() to avoid corruption of the skb checksum. Fixes: 140f04c33bbc ("ipv6: sr: implement several seg6local actions") Signed-off-by: Andrea Mayer --- net/ipv6/seg6_local.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c index 98a34287439c..2cd4a8d3b30a 100644 --- a/net/ipv6/seg6_local.c +++ b/net/ipv6/seg6_local.c @@ -826,7 +826,6 @@ static int input_action_end_b6(struct sk_buff *skb, struct seg6_local_lwt *slwt) if (err) goto drop; - ipv6_hdr(skb)->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); skb_set_transport_header(skb, sizeof(struct ipv6hdr)); seg6_lookup_nexthop(skb, NULL, 0); @@ -858,7 +857,6 @@ static int input_action_end_b6_encap(struct sk_buff *skb, if (err) goto drop; - ipv6_hdr(skb)->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); skb_set_transport_header(skb, sizeof(struct ipv6hdr)); seg6_lookup_nexthop(skb, NULL, 0); -- 2.20.1