Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3514563pxf; Mon, 15 Mar 2021 11:14:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1dciLCRp8oC6KpHTPaXWjXlj+05JpJXX7Pb7iB25/OyHfOOtWAGe1BQ9Lu6B3hpE1Bi3h X-Received: by 2002:a17:906:2314:: with SMTP id l20mr25636484eja.178.1615832047538; Mon, 15 Mar 2021 11:14:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832047; cv=none; d=google.com; s=arc-20160816; b=0wjfiO/lbBLVOSLDqWQ1MWJ8fEVMy/aK7wI6agMaMJKp/dJTiNgvA53vXmFVpdXphK gEMjjGYny4YxYb8vqf+LDsPfSE1tQjXQjNQLnf+qbHiQPl240h0MWxLXzlLg1nqOTn5m bFgM4yKO0X6jE8aRQ8bE/l5ErsmxlnHpc45TOB8Vl9g6/i/9vos0eu5CgGE0EyS5gEQ+ +rSrSH45U5tsvvOjgpOZDYVhAu3BdOyhQOzIyVlL7Y2dogg+RGFoepipcq8wJ/9DEyFN rub+B8XuSD9oKqjGi7A4i3CmO0uyCh+hjZjXZrzHcfuZGelO8VHMqvH5HRKKLK9R4pUp X2Bg== 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=B7YsW5GGxHLzkA+k+Mo99LPz5VV+we8RrLt7ObzkyzfazXQC1wowXh76LrRmdC+YTB wYFbzegAHHsRwwFCS+9fX0eDNqLuLEv8EMtHfpvGsrRJBUdLQfjLNTbVo2xKp08tQFqf VAeJnzBuoh1zRrwRqJTqNq7OJl1Wa4yqQSBwxXHAl6u0CLdzIVYVAzTTF2QoQkGd2LLp bOElLqEoTnCl0ekplI7MbMi+tcLbsMCfdnKXSaobrgrR5IGnPy5w9LRmE+7qkXChcd9i 548UhKORc6r7VSz/Ljr446AxrNQc3o5oiVTRdRwije/lbzjubuPxc3AJUbs+sGNC4mqI BOhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=srGy4Dg3; 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 c8si11170691edq.326.2021.03.15.11.13.45; Mon, 15 Mar 2021 11:14:07 -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=srGy4Dg3; 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 S236386AbhCOOMx (ORCPT + 99 others); Mon, 15 Mar 2021 10:12:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:37670 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232493AbhCON67 (ORCPT ); Mon, 15 Mar 2021 09:58:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6CD7664EEC; Mon, 15 Mar 2021 13:58:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816721; bh=THw6yf0bfiJSFbYMutcyFRFhwf/AapyQAcjRb1E+Izo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=srGy4Dg3fMGFObdzgdwlVUwF1cqcSKaKQGA2Ltjzkl2SJ72w+82QKB/oWY+R7+FvD dFiXSeeq/4r4YGFzM0tEzcOLBkdme+PLrsM1XI+gXugCXpyxt9CmnYYbNVTvV1PyFk KOaWKjpGAFG1LS0tRY8lNa3XnrcxB3yW+r2LkhiY= 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.11 085/306] selftests: forwarding: Fix race condition in mirror installation Date: Mon, 15 Mar 2021 14:52:28 +0100 Message-Id: <20210315135510.524224335@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@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" }