Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3529009pxf; Mon, 15 Mar 2021 11:34:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYLd8xvSXPW/9bUmhgmO5o7Ad5BUclGfSFr5kGFawk0lsllg1wMmAVyCs5mmoXZ833Az/n X-Received: by 2002:a05:6402:d07:: with SMTP id eb7mr30709086edb.242.1615833291468; Mon, 15 Mar 2021 11:34:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833291; cv=none; d=google.com; s=arc-20160816; b=G8+5GnGZXMCwnjeiGQyFfB29PM1Zya+m7giERV4cvmSHkAtSrIk4Ok0wc2DyKIuc+K FtZdQhhUc9In3bZ3NgTWxg0585Lu6844EOLkPTKnFN/LZGZPXnw2KGNkFB2zM3Ocg7Id ptvb2M/a/vZLELPNV7JnX4CWJVfqlYA/7LoXhhBHL3OxuF44D+sGfAwZsvGiyz80BGrx qswsralQ7LNLUTY4LMuIKRXMnTzV+3wP2GOJ4IAXzTS8MUdCILyIaLqXH1wM20nd6oxo hPQc4SIdPwMJ5eTUOy/0NcG/oHvPChkDcTNHGjHoHC1nvvzq/OgxhPzYd549F7N5eapK QQ7g== 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=Rb2y6vjWso7avH2SFD9VEM0qca5qVbm1HxMa6C/2X774PgjmzdDn/pOHd4HYAcghE2 SK4g8kdptGMpGH8VMvIX9nPWu5dCCeBCFbhsBcDNI86JAdvUNmL7qpHKdVRm5SUKIFeo g2sQy9AefD5bNBGP10jSt99snCANOdyVGfazzNmQJouAk/plJ9y0H3IqOncW3xaWkYpx C2lHKWGSGW3yBNZAgyKAem106p/ZU9VbpjhAi00X48EvdWRpgubr9E4TNfqnfkioGgk0 eV3FhKz1TUGUu8i2LuWlqEDLOG2YBK+Puf7oOEl6IeTXshY2VoC+GYKY99aCLe3lKunU iy3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tUlvEsvG; 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 q2si10627029ejz.47.2021.03.15.11.34.29; Mon, 15 Mar 2021 11:34:51 -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=tUlvEsvG; 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 S239772AbhCOOrQ (ORCPT + 99 others); Mon, 15 Mar 2021 10:47:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:37612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232541AbhCON7B (ORCPT ); Mon, 15 Mar 2021 09:59:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ADFEC64EF0; Mon, 15 Mar 2021 13:58:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816728; bh=THw6yf0bfiJSFbYMutcyFRFhwf/AapyQAcjRb1E+Izo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tUlvEsvGxSHpkkcc07GQe8yZfMyais2jg1NiaY2Jm1Pk75MPSO0w+Vw22YwbrQpd6 MUjDn7lY9sKjy/cVCfhBzOeXdK1MsY1XHDri6rFoaW82LuWMZxYmufPAq8W/JZpaqX 5hbAVh95osBB87yPcUn8Ph4dkzFBvRpIW6bRLZOo= 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 4.19 031/120] selftests: forwarding: Fix race condition in mirror installation Date: Mon, 15 Mar 2021 14:56:22 +0100 Message-Id: <20210315135721.006788020@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135720.002213995@linuxfoundation.org> References: <20210315135720.002213995@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" }