Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4840332iob; Mon, 9 May 2022 02:55:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylFVTyqP9KC/g7gw2zxtwQXERN2v0+2pNrKbv366ZGRMmMg32yw9hCRejsRXXZ65plgFmx X-Received: by 2002:a17:90b:4b4e:b0:1dc:74d0:c8d4 with SMTP id mi14-20020a17090b4b4e00b001dc74d0c8d4mr17431066pjb.138.1652090107808; Mon, 09 May 2022 02:55:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652090107; cv=none; d=google.com; s=arc-20160816; b=NH1I4TETVlqEdJiqPJCEMz/5qwT336PluXg4KbnMG6TxTfkME8MDux3vJdTknWlvx2 q9ljI5zGvu4ZC2VRzLhH7nwYaGoUdet7k1xUD3T5PJaJNzyWOGFmE5idMh7l3+045FYi HWD9Qgsj7RG0lfXHY080sv/kUbADOAEAj7/Jf/I7uD1hgVRBQwoaXFxeSjWMcncQ3wCK zXlGfekG1OzhgxObmKqeNAYiAtxZD17AsJD2/FHIR6PFR/M76zEEMs9cW9+I25l0isct fMNtWmBJgpUfe6X0hRC4VZNu6/b25wdtSq6cAZdSDMfZ0yY7A1cO1A3rIu1dqpOCwpaY hCGQ== 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=z4miucP/UJFgOTh9VSO55CQhpAs72E5M2awGYBmuA0U=; b=Fj/X38iCSYbPMnH1zDylqNXTG7d4ahFOgkykdbcOi2/lcaMjYWMTBT4TgAfmSazHjS soXwTk+96g5FTmge/woM8o4TZ0Xg/DMfm62rOHT5Izx+czNfaBJHeErWecpA4IeBg5Cd UkoL7gZ7+B89wa1OIrEGwkf0M5mZnomkY6LKlDB3qyIID449XehBDdseeYhWkP11IYAz 6j6B89hZb0k51EfctgIj1G/RPLxQTx1O7H+VuBpFnbp8rmmaDjw3rvGPC2EGL0QC6yyD g2zNKT9nQXSSfFwRnf9NzQ9bAVWfKMwslsR/KeWW8LnaEIY7uKZaZM3R6nn7CEpVYf21 QcVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zlKoPYnm; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id u9-20020a655c09000000b003c6184913b4si15007814pgr.5.2022.05.09.02.55.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 02:55:07 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zlKoPYnm; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A907FF22; Mon, 9 May 2022 02:36:42 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356355AbiEDRJM (ORCPT + 99 others); Wed, 4 May 2022 13:09:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355115AbiEDQ7m (ORCPT ); Wed, 4 May 2022 12:59:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0443A4A932; Wed, 4 May 2022 09:51:17 -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 11D81617BE; Wed, 4 May 2022 16:51:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FF5CC385A5; Wed, 4 May 2022 16:51:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683076; bh=IgovF0uzoeWjJ6e1jJzKLa2CGLQ3Xd+oBYfxoYuV/J0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zlKoPYnmrvuxlOqu2OiZgxMiywUieDEALauALpwgjf6kU/8FbQ13O9cNKvQL+gqm3 ZlNYr2QhC6gELg9vdCVOBEAqbDPtC9J9ayFynWZGxO/CMZr2noUiBBCPCaa/JYArwq SkDdB5xDBaQkEC6sdMY+JWzcpv+MiSAAGDC1E5I8= 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 080/129] ip_gre: Make o_seqno start from 0 in native mode Date: Wed, 4 May 2022 18:44:32 +0200 Message-Id: <20220504153027.455127286@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=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 e4504dd510c6..801c540db33e 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -454,14 +454,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