Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3946218pxb; Tue, 2 Mar 2021 02:41:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJxkwHq8UuEDpQpdj84pLIneMS1PRByDuqpkVNpSFXN6vhF2RqAi/xyskjchXAABoMMN01ur X-Received: by 2002:a05:6402:1013:: with SMTP id c19mr20441160edu.86.1614681660214; Tue, 02 Mar 2021 02:41:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614681660; cv=none; d=google.com; s=arc-20160816; b=OUuFBYYcPO0Cocqe+BBGZKBMTx6dkFDbxGXNpPAHypC1rpNKjaI2dgKbDBQvZ3iWhD 0dTvTzms5qJzm5McqRNva386+xnKmba1T58c5BDj+zsHDpsRUf++HZaGy0d9vy0OHTa5 uWRi1xzdpPvjiM6ND+54oGOeBtHKn1JzFsJEWK49XfM0KzAUgF/XXZLdFR+f+g/W49qW bdq1pN8jIhsFNT2fbAAcjD6m1nEprzLHAITXiagKO54XfTlHnL5EZRl1zIFviJMV9MYH 1AysRcVUfD2TKwgMsRcVFoG1iXGvVw05Q5mnVkKDVq/5dQyXKwIfuPNEmOjsWi0W1GKj ArrQ== 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=lIWusflzIXpXzjrCNqPegPmWtdRQHx0JbZAptNd53Wg=; b=Uf+0YoxaxGcrUAY4JBdNaT+Feuuw5uj4HOCwLcV6Xq/nDXD8uWlgQG7das2BVhV1Ia eMt8HDWlJG1SRjqlYpJ7VnWmnoEIACcwtD3u4xP8J9pq1T5+bxxVA7iddb7bPesIf1nc CTKBAVg0htu6Fdf7nwsbaHZ7ZjywSanz1c7bmtFwuMlFaXACiup5IKVvGUfSVLAcKXDz mBZaVnjN54q1vrEyUJt609xAYl0BjqXww341wAgCaGCMQy/FvSLEUFQoAcyH2NELaeQT zZXVeVmDTyXt3HHZxXIQstEYepgecJQffc/uwWlWI8iM0dzuya0I2sfk6n7T6c9kcvOn C25w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XQqNhuyV; 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 t16si13666820edi.281.2021.03.02.02.40.37; Tue, 02 Mar 2021 02:41:00 -0800 (PST) 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=XQqNhuyV; 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 S1345865AbhCBBqp (ORCPT + 99 others); Mon, 1 Mar 2021 20:46:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:46610 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241522AbhCATXU (ORCPT ); Mon, 1 Mar 2021 14:23:20 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 11ECB64FF7; Mon, 1 Mar 2021 17:08:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614618484; bh=NV9fGt0mpJcVALe3T9Y1RBXJGn2NsdnAAeNVb8PNTtQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XQqNhuyVHInIV07JV4OKrhrA2FRh7cXz4UGD96cOnpUwKnAe1RPyRv/cuk1DY5ggW s+dfW1NUZ6AmoeuSVrUTuCshLI/13riJihTj1sSI7fW6htDoa+yXYr3b8tjw0n6ZSt hB3YiUf5aVAR57b0NvKMF9aVkmfA7uTfuhE1Fexg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Daniel Borkmann , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.10 096/663] selftests/bpf: Convert test_xdp_redirect.sh to bash Date: Mon, 1 Mar 2021 17:05:44 +0100 Message-Id: <20210301161146.484280922@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161141.760350206@linuxfoundation.org> References: <20210301161141.760350206@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: Björn Töpel [ Upstream commit 732fa32330667a80ce4985ca81b6e9d6b2ad2072 ] The test_xdp_redirect.sh script uses a bash feature, '&>'. On systems, e.g. Debian, where '/bin/sh' is dash, this will not work as expected. Use bash in the shebang to get the expected behavior. Further, using 'set -e' means that the error of a command cannot be captured without the command being executed with '&&' or '||'. Let us restructure the ping-commands, and use them as an if-expression, so that we can capture the return value. v4: Added missing Fixes:, and removed local variables. (Andrii) v3: Reintroduced /bin/bash, and kept 'set -e'. (Andrii) v2: Kept /bin/sh and removed bashisms. (Randy) Fixes: 996139e801fd ("selftests: bpf: add a test for XDP redirect") Signed-off-by: Björn Töpel Signed-off-by: Daniel Borkmann Acked-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20210211082029.1687666-1-bjorn.topel@gmail.com Signed-off-by: Sasha Levin --- tools/testing/selftests/bpf/test_xdp_redirect.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/bpf/test_xdp_redirect.sh b/tools/testing/selftests/bpf/test_xdp_redirect.sh index dd80f0c84afb4..c033850886f44 100755 --- a/tools/testing/selftests/bpf/test_xdp_redirect.sh +++ b/tools/testing/selftests/bpf/test_xdp_redirect.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Create 2 namespaces with two veth peers, and # forward packets in-between using generic XDP # @@ -57,12 +57,8 @@ test_xdp_redirect() ip link set dev veth1 $xdpmode obj test_xdp_redirect.o sec redirect_to_222 &> /dev/null ip link set dev veth2 $xdpmode obj test_xdp_redirect.o sec redirect_to_111 &> /dev/null - ip netns exec ns1 ping -c 1 10.1.1.22 &> /dev/null - local ret1=$? - ip netns exec ns2 ping -c 1 10.1.1.11 &> /dev/null - local ret2=$? - - if [ $ret1 -eq 0 -a $ret2 -eq 0 ]; then + if ip netns exec ns1 ping -c 1 10.1.1.22 &> /dev/null && + ip netns exec ns2 ping -c 1 10.1.1.11 &> /dev/null; then echo "selftests: test_xdp_redirect $xdpmode [PASS]"; else ret=1 -- 2.27.0