Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3000044iob; Fri, 6 May 2022 15:34:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxg5BYkeQzpG8lq8Bc/Tpnug14G+J0kVidIYOq4w265jIjgdUTjsF8NoiekqRjTmhRo+W1s X-Received: by 2002:a63:fe16:0:b0:3c6:48dd:f7e4 with SMTP id p22-20020a63fe16000000b003c648ddf7e4mr3903436pgh.458.1651876485961; Fri, 06 May 2022 15:34:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651876485; cv=none; d=google.com; s=arc-20160816; b=S+ViW8FMVK4d+9Ev73gmBsadNEQW2ca8HoAOBTtFxK+YM1CZCHgMsAJ/LI6wbuHQeh dMnf/oFpVYZicaRt6rTuQnKCwne3gPpprodEoBYQArp35Ip94ffrG/4eUi0z7EBThFNC 1FXX1CEir8BNDhXCHVSuiODvgC4cPScDLozqjo1dWQGJYRKEgAbKvdIuZiOlb/qOSYek skS93CbHbw8SHIqhzNY4Wh1oeS57V/ayZwy0hvahhgYOOm4a9CGD4k1k+dg6EyeU81nA TyTlgHcL4CMTnVjc/vO7j8eRGmsu96wR3Dods6LDd7TT3YwKt9aOfr7jh9BN2HPuGzL7 NOyg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qlfQyyA/XppyX7Qsq2GrQbUg1zsHEgWhpXUC9j7x6zM=; b=u77RGcf7jx4ZP4TE4v1NWZOEPLfiOSO4nPtRBH0OCUPb/yKnm0LNSjyGLSx12SqEty ymdBXeO+cujPoFKpfcBQjMNsgK220uLFKc+6mR1SK7uxi992v0DgGfHacK29P+iyISWV uVSg64K8Y2v3WIpcSL/SQxo9VrYORQ8v1uzmMCUDMQ9G/e1fCc/KzCvVSN/K6CVLNBLz DqOVe9bGqmWAKMgNIFKezm1iG+O26Z5UR7kiWUtzw+yX+HjrWcMgcK9CI/+7E/lPDhaU hmLmlwFEUGlsNa0g6ckhYdUUKVXRzVFHV6aU/PcfyqLOgNxoc2SLBh8XSkBYyLHL7thw SoDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NtaonSGc; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g22-20020a170902d5d600b00158e89eb6f9si3243033plh.538.2022.05.06.15.34.30; Fri, 06 May 2022 15:34:45 -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=@linuxfoundation.org header.s=korg header.b=NtaonSGc; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352406AbiEDRHZ (ORCPT + 99 others); Wed, 4 May 2022 13:07:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355507AbiEDRAG (ORCPT ); Wed, 4 May 2022 13:00:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A6054B1E5; Wed, 4 May 2022 09:51:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AB8216187C; Wed, 4 May 2022 16:51:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01709C385A4; Wed, 4 May 2022 16:51:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683099; bh=vrXHUeiBGCc1SZvHym5m4/ZjOsgwzIuFcFfu5qMi3QY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NtaonSGc9lUzIJmOOijGueFLtogW94Jv15MxG3XkC0+xhxGYAYQ+87jqN8RZJ/Bsd I7MABiijs9ahJydNZm6dVyi3Fbezz0uVKj9vchw7PbGJfxjUz2Ecbx/ZK+V/5FZ5OO QOo9hRKI4C2+9GhOIuv20NAdwvDFpGPh4gMS4sHA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peilin Ye , William Tu , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 081/129] ip6_gre: Make o_seqno start from 0 in native mode Date: Wed, 4 May 2022 18:44:33 +0200 Message-Id: <20220504153027.510923900@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153021.299025455@linuxfoundation.org> References: <20220504153021.299025455@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Peilin Ye [ Upstream commit fde98ae91f79cab4e020f40c35ed23cbdc59661c ] For IP6GRE and IP6GRETAP devices, currently o_seqno starts from 1 in native mode. According to RFC 2890 2.2., "The first datagram is sent with a sequence number of 0." Fix it. It is worth mentioning that o_seqno already starts from 0 in collect_md mode, see the "if (tunnel->parms.collect_md)" clause in __gre6_xmit(), where tunnel->o_seqno is passed to gre_build_header() before getting incremented. Fixes: c12b395a4664 ("gre: Support GRE over IPv6") Signed-off-by: Peilin Ye Acked-by: William Tu Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv6/ip6_gre.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 1f6c752f13b4..09262adf004e 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -724,6 +724,7 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb, { struct ip6_tnl *tunnel = netdev_priv(dev); __be16 protocol; + __be16 flags; if (dev->type == ARPHRD_ETHER) IPCB(skb)->flags = 0; @@ -739,7 +740,6 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb, if (tunnel->parms.collect_md) { struct ip_tunnel_info *tun_info; const struct ip_tunnel_key *key; - __be16 flags; int tun_hlen; tun_info = skb_tunnel_info_txcheck(skb); @@ -770,15 +770,14 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb, : 0); } else { - if (tunnel->parms.o_flags & TUNNEL_SEQ) - tunnel->o_seqno++; - if (skb_cow_head(skb, dev->needed_headroom ?: tunnel->hlen)) return -ENOMEM; - gre_build_header(skb, tunnel->tun_hlen, tunnel->parms.o_flags, + flags = tunnel->parms.o_flags; + + gre_build_header(skb, tunnel->tun_hlen, flags, protocol, tunnel->parms.o_key, - htonl(tunnel->o_seqno)); + (flags & TUNNEL_SEQ) ? htonl(tunnel->o_seqno++) : 0); } return ip6_tnl_xmit(skb, dev, dsfield, fl6, encap_limit, pmtu, -- 2.35.1