From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2703AC48BE3 for ; Thu, 20 Jun 2019 18:14:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F21172084E for ; Thu, 20 Jun 2019 18:14:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561054483; bh=2ifiMgl8orG4/FZtSN1k/rJ/Xz6HkjDxpOnrOdsp394=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sSPRdQ3FbrDa9v4frSlCjjQBt3hUydWC2E6MzkYNgfeR+TzTDNp7yDKU4Qa49G4rv jApeK4/bFXKQbM9dfEauvwA+F21os4wMlkuhP6G2thFtswxRmma4yc3SZ0mbGyw/ay rZn65kqlbm3QEDkI+ctGUwiHocxNLUy3GWO2baYc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728670AbfFTSOl (ORCPT ); Thu, 20 Jun 2019 14:14:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:43094 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729474AbfFTSOk (ORCPT ); Thu, 20 Jun 2019 14:14:40 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4385121530; Thu, 20 Jun 2019 18:14:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561054479; bh=2ifiMgl8orG4/FZtSN1k/rJ/Xz6HkjDxpOnrOdsp394=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1P66H9X8wvarAQ7WHz0M1hbOvSHpeel1uzLLg1oyHDGfnLOd8lApsi5G1gBhM0KHd CHwVX07XgdYvV1QYJVzgrLB9HT3alT2LWvN4yY0Xn6pVVTRfHXSkjlKaZoCFnipWGh Ytg6WiNicPT5uHmE1KZrCinFKLGtq6Zao1+7IAWk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeffrin Jose T , Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.1 42/98] selftests: netfilter: missing error check when setting up veth interface Date: Thu, 20 Jun 2019 19:57:09 +0200 Message-Id: <20190620174351.022943386@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190620174349.443386789@linuxfoundation.org> References: <20190620174349.443386789@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org [ Upstream commit 82ce6eb1dd13fd12e449b2ee2c2ec051e6f52c43 ] A test for the basic NAT functionality uses ip command which needs veth device. There is a condition where the kernel support for veth is not compiled into the kernel and the test script breaks. This patch contains code for reasonable error display and correct code exit. Signed-off-by: Jeffrin Jose T Acked-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- tools/testing/selftests/netfilter/nft_nat.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/netfilter/nft_nat.sh b/tools/testing/selftests/netfilter/nft_nat.sh index 3194007cf8d1..a59c5fd4e987 100755 --- a/tools/testing/selftests/netfilter/nft_nat.sh +++ b/tools/testing/selftests/netfilter/nft_nat.sh @@ -23,7 +23,11 @@ ip netns add ns0 ip netns add ns1 ip netns add ns2 -ip link add veth0 netns ns0 type veth peer name eth0 netns ns1 +ip link add veth0 netns ns0 type veth peer name eth0 netns ns1 > /dev/null 2>&1 +if [ $? -ne 0 ];then + echo "SKIP: No virtual ethernet pair device support in kernel" + exit $ksft_skip +fi ip link add veth1 netns ns0 type veth peer name eth0 netns ns2 ip -net ns0 link set lo up -- 2.20.1