Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp930632pxb; Fri, 22 Apr 2022 14:38:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwU1u24SlU9TDCxXShNyi/Kad1f6uc07cp77PW/1aG9vq/grLLQez8CYAUObBe0UTCywGhV X-Received: by 2002:a17:90a:a081:b0:1d8:de21:1714 with SMTP id r1-20020a17090aa08100b001d8de211714mr2970205pjp.147.1650663487900; Fri, 22 Apr 2022 14:38:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650663487; cv=none; d=google.com; s=arc-20160816; b=jKZ0pqJYp+IUju0gx9ORjQ5f2muOyZ2pXd8rG2YhZlSZpzT18eS4phs/iG5wUochJ1 hZpPza7/41d+Ufk2IPb8n5fmBSGni4/UW545N6cs45xgawxT35z+6Sa05umvL3LMY4qU CX2AMtbkcsMhnRvQu5qzyj4NEsvy70+PoXZwXdKxJbY6iWhCmyTpNvK5swMGfkzVTQ4B GgF3QsoA90B1HMm/cvSfLqu5H/fuRXW2ehiyiTIUBh44jozaLYZRwGJXx65xaoqHUjEr UV6IL37KlJycMz+shFwAAyysrHLfPx27l+cg18SeOcDCNITiKXlcG6vfoOAEEbAkoWRT v0Mg== 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 :dkim-signature; bh=6gYFSoVcpwLd28VgNWwfiPjbVU28eosEw1LDKSZ8KQc=; b=hWpU7JSzNGNZTtJRjO2d0BJKFtFWPa6kjaB7bvj6T7YlK3iGhLt9vroWzsx6kRxJEK kckQx2/nHayMD9ll8tyXkef1FTKU6yypzlSDTbj7ebVIrP6kT1rqmdAzz0TM3qvsFAMP yr+T3vVE9voxP0lgzI5LwWBzOaulsEnLqwLSmbOGtnhchgjUUBo9ZBIZe9NnDv4Izo29 ueTWLNe4TKbx4oN4MELECSbgTTuJ+vK9mz6kyCo45xjF603csgSB99SqWs3V0SMp8s9Q B6ehV8tECqZ7BfoyuApMtMl0l9WSI9dpbNR5U2Ucm7kLjOz1no+yd7Zh6mm3sLK53w2F 8oEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZJDNoA9F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id y2-20020a17090a86c200b001cb8b9109e9si8318507pjv.45.2022.04.22.14.38.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 14:38:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZJDNoA9F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C50022216A7; Fri, 22 Apr 2022 12:45:44 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442353AbiDUWLF (ORCPT + 99 others); Thu, 21 Apr 2022 18:11:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442351AbiDUWLE (ORCPT ); Thu, 21 Apr 2022 18:11:04 -0400 Received: from mail-qv1-xf35.google.com (mail-qv1-xf35.google.com [IPv6:2607:f8b0:4864:20::f35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CA234EDDD; Thu, 21 Apr 2022 15:08:13 -0700 (PDT) Received: by mail-qv1-xf35.google.com with SMTP id d9so4723648qvm.4; Thu, 21 Apr 2022 15:08:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6gYFSoVcpwLd28VgNWwfiPjbVU28eosEw1LDKSZ8KQc=; b=ZJDNoA9FyoglICDWyPkyyPe9AqQzHNUZSXcw2ST/ZWMMRff+/7FUB2XngF5Gad1Xax 756WjkDh9c+tZBn2MKByXXylogEPCrIgdkFXvWbxNocv2EpK8I7JbxENgwhvcf72qDNr WoIoCxeHdzlLfUvVZz+BWTTscphkXG8wWf2BjLRYfXnD64NxQsXv1sI/5h7ZHEYnNArW CnHcpoYEi9DsmlPnI0q9HeT5xo+tPZzr1Y65b2+424+m3w3TGGlIuIZh7eon4MEVnQAz QLjwm6yPntWJ6MuHZrF70BwHvB/h/N/FIiIYHO7cxvkLVgeKg7RfGfSWfluM6e9mQnJc d/UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6gYFSoVcpwLd28VgNWwfiPjbVU28eosEw1LDKSZ8KQc=; b=TOLuLvmu3ctT1ZDcI8BJbJAR2y5zD2BEAIlMqUQWCGsx25Nl8Sfm3PQ065R6qYXFmc 4Dg0ieWjCizAsqtTgN+y6vS9yGy2xdyO4dqAbTbAwyX3fs0JEu08PIvpa9kVjdOyYMrn H51OMJcbJQdP3aplzz6UvJ6crBD3rn3yZq+RHzoafVlR1xnvGnQHhuvayzYTPrYz9a+c B8DUchF+AKKKTIiuWVLr8U8CN5XPqPFIKKevZo0Im92DP2s0w0JVYFbsJAK6XEkfs1FF w5+e//1kjJjzJoiD23tGjba0eHDY4YPNdUFV7gUIKSQDE3zcOshW8Q2HkTxFwTjEezmP 80iQ== X-Gm-Message-State: AOAM531NuWxIP1bNBQ1GTPdxeFIpczEkR54WFVpt4XEm7TK/5uqCJ0/J 3wzimtHgdOkuzbQVnJsF3Ls49aPdoQ== X-Received: by 2002:a05:6214:5284:b0:444:10c8:ee59 with SMTP id kj4-20020a056214528400b0044410c8ee59mr1525618qvb.68.1650578892675; Thu, 21 Apr 2022 15:08:12 -0700 (PDT) Received: from bytedance.attlocal.net (ec2-13-57-97-131.us-west-1.compute.amazonaws.com. [13.57.97.131]) by smtp.gmail.com with ESMTPSA id h18-20020ac85e12000000b002f341c6d20esm182178qtx.80.2022.04.21.15.08.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 15:08:12 -0700 (PDT) From: Peilin Ye To: "David S. Miller" , Jakub Kicinski , Hideaki YOSHIFUJI , David Ahern , Paolo Abeni Cc: Peilin Ye , "xeb@mail.ru" , William Tu , Daniel Borkmann , Cong Wang , Eric Dumazet , Alexei Starovoitov , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Peilin Ye Subject: [PATCH net 1/3] ip_gre: Make o_seqno start from 0 in native mode Date: Thu, 21 Apr 2022 15:07:57 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no 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 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 --- 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 99db2e41ed10..ca70b92e80d9 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.20.1