Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6277778iob; Tue, 10 May 2022 14:42:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9yG/zS57Ce+zomEOHlexHxBBV9b26xDiyq79M1mcvcQsFA8k+sKOcui1RuHes9bTb5Vej X-Received: by 2002:a05:6402:1544:b0:428:b439:9a01 with SMTP id p4-20020a056402154400b00428b4399a01mr5797779edx.201.1652218967658; Tue, 10 May 2022 14:42:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652218967; cv=none; d=google.com; s=arc-20160816; b=Nkn2n13syxObKUpYQ8QoZQlIYYJ+l+BuD23asy1t2yV/1CYV+u4Tz6QlWf2SnvG+eN pURyyyYiSPtt0l0KU/9L7TLPlEIz+wYFQYgwPUjl6j1tOMA4hEZxmPuCA/Cj6LWqlnB1 Bz46NuKqWeXSmC6MYKmbVZn4S0NeYGx/gXpdgfGULNpFqmsJXdkjNmwfUj6jqq7nc6b8 F5nU0X/UMCkwhhZ/C7FEtlqRDf/MXU7W5eXImf9MJZfsvnxrltVBubG2xw34Sxv77Pn8 GKO/78CMdnOfIszvrQSFfT+EFCN50+Gkiobm7bLTv3CfbSvRVMdZRF0n4/HL1yGiNFGD cHeA== 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=aZ2lD6KG+ywDm2Uw/5L6U0rqdvbZu50tnx22Ji9oxG4=; b=Svpzw8rM5DenL/XhGwSsiOuK0a2b3gEm2NHc9u9Qji+K1Vc3LBycjHqYJQG2iObF0o n5RXxjfaXGu0iHPk94W5bZREf4T3260kHcwzvF/wD9ccO/mf3yBqznKOLAdjOTukIXrF MZCtXoU4OYSfHTZKv5HVDflCPOCka1ANG3QO+nnzjCYkJ7w8Yv+71q0ZDvlwCaFDxaJf nPJRGA2XAKneQhQGsjHrz22GEq3qNmQG47DEQyeZCOHPLGU9Ze7u+uT2gnsutimURNKv FrPxmsIAZEkqC3Yrku+Y/QYMSUTGZfI6hse09mZPhicWg7BC86y16X9Skq1X2wjPjoWC /Tuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KXeYDqHu; 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 nb29-20020a1709071c9d00b006f50917110esi636121ejc.163.2022.05.10.14.42.24; Tue, 10 May 2022 14:42:47 -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=KXeYDqHu; 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 S238934AbiEJNaL (ORCPT + 99 others); Tue, 10 May 2022 09:30:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243742AbiEJNWW (ORCPT ); Tue, 10 May 2022 09:22:22 -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 A28D113F93D; Tue, 10 May 2022 06:16:46 -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 56F9D61574; Tue, 10 May 2022 13:16:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CD78C385A6; Tue, 10 May 2022 13:16:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652188605; bh=Aguhp1BFM4cMbxLn8rL9GAdEBOd9nfdi2j6i0pTxaxk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KXeYDqHuTmue6lROai3I/48qXWVZzGKhLP5JdCt3FkTNg8RmLwgXtz7tlqIuGoI5I iYcTAs3gQ1jzPkoEzsV9WKD5tpLI+DuY99zyWIQnnSOaswWo8R5HzzsTQO/WCgUCjS v+8VdcC90JMnFb9P7wC1Uqwze2EdW15PcWK0j9fg= 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 4.14 35/78] ip_gre: Make o_seqno start from 0 in native mode Date: Tue, 10 May 2022 15:07:21 +0200 Message-Id: <20220510130733.574189963@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220510130732.522479698@linuxfoundation.org> References: <20220510130732.522479698@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,URIBL_BLOCKED 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 ff827beb706ed719c766acf36449801ded0c17fc ] For GRE and GRETAP 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 gre_fb_xmit(), where tunnel->o_seqno is passed to gre_build_header() before getting incremented. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Peilin Ye Acked-by: William Tu Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/ip_gre.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 1a4d89f8361c..d916accd9783 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -429,14 +429,12 @@ static void __gre_xmit(struct sk_buff *skb, struct net_device *dev, __be16 proto) { struct ip_tunnel *tunnel = netdev_priv(dev); - - if (tunnel->parms.o_flags & TUNNEL_SEQ) - tunnel->o_seqno++; + __be16 flags = tunnel->parms.o_flags; /* Push GRE header. */ gre_build_header(skb, tunnel->tun_hlen, - tunnel->parms.o_flags, proto, tunnel->parms.o_key, - htonl(tunnel->o_seqno)); + flags, proto, tunnel->parms.o_key, + (flags & TUNNEL_SEQ) ? htonl(tunnel->o_seqno++) : 0); ip_tunnel_xmit(skb, dev, tnl_params, tnl_params->protocol); } -- 2.35.1