From patchwork Fri Apr 5 16:33:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffrin Jose T X-Patchwork-Id: 10887625 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DAF7E1515 for ; Fri, 5 Apr 2019 16:33:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3D5228A56 for ; Fri, 5 Apr 2019 16:33:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B7F5C28B1C; Fri, 5 Apr 2019 16:33:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C78A28A56 for ; Fri, 5 Apr 2019 16:33:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731263AbfDEQdu (ORCPT ); Fri, 5 Apr 2019 12:33:50 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:43240 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729269AbfDEQdt (ORCPT ); Fri, 5 Apr 2019 12:33:49 -0400 Received: by mail-pg1-f195.google.com with SMTP id z9so423882pgu.10 for ; Fri, 05 Apr 2019 09:33:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rajagiritech-edu-in.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZdohzeVgbbKHEv1a2YghmfxHtlO8ojKInm2nc2fqSSY=; b=u9QlIUrMkbrakZ0xwuWSPKfQQIBD+bajPXl9nlJoJ5JPba9BCt84CEfnThWxuJGs97 MfAEu411AkjPCFaVQAfLqWB/4BWDZl1xOWeCM2/QJHiJZF2+6L2KgDhSOwhwYRQpXUa1 Q2iLVkCrz6HVVdHrg6Yco9y6j5WDtNbBPrgEj7cEV8YK40XADIC6Q8bW3UEnBFMujidD 2cGZ3bS8lAYRpigBZt49de0wSjlx3bUaIiaXW+QlJhJvMqk6wTjVjUtJWC0d1LwYBcF5 y0GP992Xrf8dFsUAV9Xiw1dYaI/8D4qL/092HNVuG29UrLyZ2qM28+bSaCDO1lH2J1ef 4SeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZdohzeVgbbKHEv1a2YghmfxHtlO8ojKInm2nc2fqSSY=; b=IDq/Pyce0LuNCrhekgpS5z2LxY15pJTeW5NdeWzk/EHYaRL2xdtu8m9Qxh3+PmA1/r WK0AQAVGGCUDB5Y/I4n+5jPEomrAWzISEOaa+s1D5IPM9HZe9pJOMvlSJOp380xpSaOP i42+ZjW9RwEV5ZrlpMkb7Z3gToUBZP9e1ilsW7uJUbxwxF9OI6dCzrbdfjIZ4Flc5yqm xAGC/Wjrv8fHDALI/9XUMY6EGRKSpIUjWqQerxPL8HbT8ydCNX7IDoBbLWutWrDomucU W7xoToRH3GJ1s9TTQRD9TJgiFVvfdT8QSwWTIXu3ETXRxrFHNd+wyg0laAs/UVQnpV/l yIvA== X-Gm-Message-State: APjAAAVxTaFyeOude8Wj6+wRvV04o7TOlVE+Jlmj7Ncb+ueN5gtUYaN/ Iq+FE0EtOkh0NhY5Kj4ocZZI/S/9uVs= X-Google-Smtp-Source: APXvYqx1PcbqqAFSrV66pF5KxKMYwdHtTF/ON49J7OrLKA6qkFl4Xo4sKqUC6H7ojYj9Q+meDRJsaA== X-Received: by 2002:a63:614c:: with SMTP id v73mr12851316pgb.395.1554482028244; Fri, 05 Apr 2019 09:33:48 -0700 (PDT) Received: from localhost.localdomain ([27.57.24.62]) by smtp.gmail.com with ESMTPSA id e2sm42071237pfa.64.2019.04.05.09.33.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Apr 2019 09:33:47 -0700 (PDT) From: Jeffrin Jose T To: linux-kselftest@vger.kernel.org Cc: Jeffrin Jose T Subject: [PATCH] selftests : netfilter: Wrote a error and exit code for a command which needed veth kernel module. Date: Fri, 5 Apr 2019 22:03:38 +0530 Message-Id: <20190405163338.7361-1-jeffrin@rajagiritech.edu.in> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 8ec76681605c..f25f72a75cf3 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