Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3511021pxf; Mon, 15 Mar 2021 11:09:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzB8N/GdVxlTPE7k4oI0AFXvvzJ2p7tXXB4jtjndI0gTXb6EoNF2tpFtAQNpToj9dJl17qF X-Received: by 2002:a05:6402:3596:: with SMTP id y22mr31619905edc.207.1615831746915; Mon, 15 Mar 2021 11:09:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615831746; cv=none; d=google.com; s=arc-20160816; b=i3EgPVoaWBZJvh+HL/HlPBgDGuIp52tiG4BHxhmz1uQv+GZhcD53bZM8UnMPUrtq7Q 6QPmGPTjR5Mc4KjA6fYSdJRAXNvWEoXHsFjI/+KHkGxXysVgoryWjStPoIk9ZqPECYQF zAnBu/tO/Z11RpywNznNvaJmUYU1wSS0eBf5kj5Xoy5KDy918dMXmTfrfFUyiBvIwXZH W6n77UMVQiKdBsVeXoziPyb09XVuUb17aLtOvVAx4OKt34EIDU7vseX8tulNdnfeCQvh mhStBF1X1fRTch94BIQZv/suNRkzFqa3VW4aWh+FCA2f929aJKP0CYmmx4DMkZUD378M wSzw== 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=MSyQNU6HpSMUJGpkKu4tfYTIjmrMlkvqXM2hn24tKuY=; b=Ff0UuAKKHgbXXt+NgFQxXYMFdco6ML/4SYw8eWIbBQnefskn35HZu5heoyb3kQxR3h FnH7Tc9cBNqB41JOknHAfhVxEUk2I+s0dorbvyJ7NZBnsQnd20nFfC27Wy3hINXJ4Kv2 f8WplH8Tbazy+5wKV25PBoF77U8WoR5ZMqVRs1abKLXslpJZuJDOJS2+rkjfmXKTYcL2 rRSMGsil31sdkcN/ibPv7TPpR26jZN6mk+NivMb6yTJzSDcva7VvztY3wR5jOQgMu1/W qJ8IE0HKjnXYwxYCBypnj8wuoroIUKmqW2nwt1AAPZlH1zdw6nvCJ0MBFcA1JOKfLDwR GxKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SNxM9fWR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q1si11706391edn.100.2021.03.15.11.08.29; Mon, 15 Mar 2021 11:09:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SNxM9fWR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S230200AbhCOOJP (ORCPT + 99 others); Mon, 15 Mar 2021 10:09:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:36238 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231997AbhCON6D (ORCPT ); Mon, 15 Mar 2021 09:58:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5A9E764F12; Mon, 15 Mar 2021 13:57:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816676; bh=THw6yf0bfiJSFbYMutcyFRFhwf/AapyQAcjRb1E+Izo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SNxM9fWR1P+EyLbVoifuUyyDYtxma70gEx3MaSiII47S/bgsWX2zvND3IRc6INgOt 2UdIw1E3LquCYG1LAx3pLanP8XQ4AxfzMeYO0ZEvLuCjAsgzLLxm95+ta7iubqSZiI VWhsxDnl+CdD/BuY1BWw5dRLZnKf3jWiesqw1Hxk= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Danielle Ratson , Petr Machata , Ido Schimmel , Jakub Kicinski Subject: [PATCH 5.4 041/168] selftests: forwarding: Fix race condition in mirror installation Date: Mon, 15 Mar 2021 14:54:33 +0100 Message-Id: <20210315135551.705337157@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135550.333963635@linuxfoundation.org> References: <20210315135550.333963635@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Danielle Ratson commit edcbf5137f093b5502f5f6b97cce3cbadbde27aa upstream. When mirroring to a gretap in hardware the device expects to be programmed with the egress port and all the encapsulating headers. This requires the driver to resolve the path the packet will take in the software data path and program the device accordingly. If the path cannot be resolved (in this case because of an unresolved neighbor), then mirror installation fails until the path is resolved. This results in a race that causes the test to sometimes fail. Fix this by setting the neighbor's state to permanent, so that it is always valid. Fixes: b5b029399fa6d ("selftests: forwarding: mirror_gre_bridge_1d_vlan: Add STP test") Signed-off-by: Danielle Ratson Reviewed-by: Petr Machata Signed-off-by: Ido Schimmel Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh +++ b/tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh @@ -86,11 +86,20 @@ test_ip6gretap() test_gretap_stp() { + # Sometimes after mirror installation, the neighbor's state is not valid. + # The reason is that there is no SW datapath activity related to the + # neighbor for the remote GRE address. Therefore whether the corresponding + # neighbor will be valid is a matter of luck, and the test is thus racy. + # Set the neighbor's state to permanent, so it would be always valid. + ip neigh replace 192.0.2.130 lladdr $(mac_get $h3) \ + nud permanent dev br2 full_test_span_gre_stp gt4 $swp3.555 "mirror to gretap" } test_ip6gretap_stp() { + ip neigh replace 2001:db8:2::2 lladdr $(mac_get $h3) \ + nud permanent dev br2 full_test_span_gre_stp gt6 $swp3.555 "mirror to ip6gretap" }