Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3524048pxf; Mon, 15 Mar 2021 11:28:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzk+pzWtr/jh7xhUQLiLbpHKeFOLVaQ5XFksvj2ODJdA3ocXBQFSZofpGJJdkLepPyQOuyr X-Received: by 2002:a05:6402:10c9:: with SMTP id p9mr31736304edu.268.1615832889127; Mon, 15 Mar 2021 11:28:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832889; cv=none; d=google.com; s=arc-20160816; b=nqCSw2q/BIPsqgHoo4o14wmGlMCwjtjv3hYCnjNTMXEKCJpQKNpT8i81f0M8szqt3V UArw844ZzQoXcaVk8nc0n+yAavj213srWzvll+vZ1PvTL2GOwJNZLnCLFgrBGOuQEUT5 ktJ4wLBfXxYmFzZ6bjQCVv8OOSHOZGihFBjiq6U59RODIZoTGXKB+oGORhL0fcaZ1bX2 ZXTTh8kwpuof7uhgR2wHde8p4G5ikh5tI8bM3b6DTWxKjQr2UUiYkDVhMHOIMw/4Z0Kw q5vyzi+A/oDsMhE0e3NtGGSUsNLzJg1uyHWEv3n5tY0wAMFnOMixeNKeTiHsU4r1DEko 8bbQ== 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=O9nuxrEfnQdHNFGyKFzr8YbAPh9uSgDpy9QoTwiy6b5XyNYLZ1whr4uyzzlipWACGK KDulg08z7D000+Pgj+miuD6WrOl3Bk0zwNoIQ8MjRqI2k5iHrJV3iwsVWWY1D8zzwo3z cwBQ1QFQzqX8Lec7ndBEDR1D5MSQvrwYSclzt1qW0p7WzLWMmHSqRDbV7YuIfQIDDmiH I4oz6c8AqziVlpmEczH3sCs/koC9YaPe36T4wDXOw8WgvOaWPM9SjWD4wXu+1bduwHWb U6C7bTC8IyW26L6ob+2/M/4YebdMel3FmTIIkiRqnxTo+4yPS3e4rervs2z3k2pbP1Ic /ygg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YhWuIRs+; 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 z14si11956143edq.36.2021.03.15.11.27.33; Mon, 15 Mar 2021 11:28:09 -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=YhWuIRs+; 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 S235476AbhCOOaX (ORCPT + 99 others); Mon, 15 Mar 2021 10:30:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:37522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232261AbhCON6q (ORCPT ); Mon, 15 Mar 2021 09:58:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B5F0064F3E; Mon, 15 Mar 2021 13:58:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816714; bh=THw6yf0bfiJSFbYMutcyFRFhwf/AapyQAcjRb1E+Izo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YhWuIRs+dRbClFpjmLNm8M7ReR2DasiLMGiVOszgANpbLt3Yt8Ee11SPjwluHU9Ut 2+/RVVSO3veA13EeeXsfXapBHRiIrviXD2tSRlnXR8Etsc5k7y6c8o9IS//31jybdn Is5RhuzLxTeK9oZsQrWr4fQ4Zet3R8tSfMpAYzWM= 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.10 071/290] selftests: forwarding: Fix race condition in mirror installation Date: Mon, 15 Mar 2021 14:52:44 +0100 Message-Id: <20210315135544.303884819@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@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" }