Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1236096iob; Wed, 4 May 2022 18:19:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtGh0FF/4iRqXKkNl1hU1IFDHVSrvkF0APtfhxfedaaPEX8PC9m/bgqAQtoGo7BI7rlqfS X-Received: by 2002:a17:907:3d89:b0:6f4:7e66:b500 with SMTP id he9-20020a1709073d8900b006f47e66b500mr11648914ejc.134.1651713588673; Wed, 04 May 2022 18:19:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651713588; cv=none; d=google.com; s=arc-20160816; b=BpO/TG/GWQaClEOAhUblJAL/C3Oiz186aZCkSO21s4TVlNQnfRjspdGVGR3p39i8vM Jyc29uQppyt3ZRpPK43SwQdvw+dNYe5R2b0UEZXzIVp9yoQwtb4+abT6ZyF3t2OJsSRu cCSoee5rI+yAwBlzHsLOdfvAvzm+CqtyVs2+OXJt0kA1sazA3J5pTWXZZWbHoLFQ3VRw uY31Bw+OQs7v361ZbbMJUPoCVlBVpfWHA/VMDi0wiHyOxOx3UdufYpna5V7ZU7NiQMEc d0NZdmQTB+hZ4nrbA34xskKatFxRJhFh4cwa9FY+umkCwSmmWE7AMe/0Ea9MQzrl8IcY 7HRQ== 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=6zf8P9Arh64Ec06UPSAB6S893wy/dGcntqLG0PKp1zI=; b=lv3EIhMU8Z85VW8LddDOv32dO1PpQA8ZafOvTzqv1Kz/MRGo0GeLL/BUrbzZiInO+m hj7UFvyUYsdfaTUPc4tyAEjIUMwHF1s8Vn5RxStMBcJu6W+bpZempTNxKnch3a7z3Dy0 1GW9JiJsNQVRDDOQLCDCsbbMRawP+ihrBlkU9zOSKlXn06vxUxXjFJtjqQA+6ICBt3p8 wcHxI/R/aFy4NJx2HUWc+wGaPSG22+gIpKDR0zyKvQ1pF4Jq6Tp4bCuLKezyXJwjuhL0 sf3AKDnymq/ddkf0PFbWEjtRwG6qZLovEnvA9XDo7NCoYO7Y1/FZczAT6EZ18O5VraN3 TG9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="LxioS/J+"; 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 f14-20020a05640214ce00b00427f9b748c5si236383edx.519.2022.05.04.18.19.23; Wed, 04 May 2022 18:19:48 -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="LxioS/J+"; 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 S1355911AbiEDRUo (ORCPT + 99 others); Wed, 4 May 2022 13:20:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356406AbiEDRFL (ORCPT ); Wed, 4 May 2022 13:05:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBB8350E11; Wed, 4 May 2022 09:54:06 -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 0BD4061896; Wed, 4 May 2022 16:54:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A181C385AA; Wed, 4 May 2022 16:54:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683245; bh=25ux8NFNKLydnTHHEQeLqGsVmScposqAAuPdXMHZvJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LxioS/J+4QDjDI8uyqLst8p1jswCXJ62U00GeeTH9/DotPWqifHx0gVxC+Gtg4y/j /tH4rATvDEK154MW+w9RoOtjwA8Gd8PGT2GJEfvZRfbDB4UbodZ4Rqtf2zzC1p3LJ0 vpl2NNeaNdx5r5qq4ZM9iTTeGfrEYBYRp6nCw4DY= 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.15 098/177] ip_gre: Make o_seqno start from 0 in native mode Date: Wed, 4 May 2022 18:44:51 +0200 Message-Id: <20220504153101.902753048@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153053.873100034@linuxfoundation.org> References: <20220504153053.873100034@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 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 e7f3e37e4aa8..4b7d7ed4bab8 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -459,14 +459,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