From patchwork Wed Oct 6 11:47:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 12539307 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02C2DC433FE for ; Wed, 6 Oct 2021 11:47:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DF7EA61154 for ; Wed, 6 Oct 2021 11:47:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238373AbhJFLts (ORCPT ); Wed, 6 Oct 2021 07:49:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238117AbhJFLtq (ORCPT ); Wed, 6 Oct 2021 07:49:46 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 800FDC061749; Wed, 6 Oct 2021 04:47:54 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id x7so8734827edd.6; Wed, 06 Oct 2021 04:47:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vt0NBmFfay7kkrnrDFUj1c9VXYawXVmI+68SUXjE5XQ=; b=jUH3vTk4EL2k5O2twAyUHIl+Oq7b7GjhOjSIJlTZOVqGTb5W3rGbTg+hNnO2rrogJ3 B/cm54x9tqi4dE5pjbzo9y1P8a+BDwzLT/jDMQf8PZqlC3esKlOiwQ+9sP8ua6oAFAix sREDOaWy9XnK3c3FuPoq9AOaFXgzyqNpeXIJuW6zJoZ6Rgcn49M8JY1s3EMu3mZRK/Yf zoKsd1tKQ/99I+aHCYKOpVuX62pn4PhWn+7O0ge5xTr8ixQ9CLG3LEsiqBmvLxPc56qW MCkxYNOjZm7WOONJPY7sgJ3/d7wJUW+pfZpNCnZrcrUvaTPXA8aO2URUCY2MGsWDVOXr zM2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vt0NBmFfay7kkrnrDFUj1c9VXYawXVmI+68SUXjE5XQ=; b=oRU76LhKYEgQKXa76i3Pyk6qDAcLqk/kluk/g8/jT9MJ5qnspQDOjTffAl/cIJ24vf A13AmQm8Qe98r4BC0A7uL0tGnr3q2inw/SjRkcULjnvTB+lDHyB/JToWxLlzUCI0xnow 9Mz/UksOB0SzNttW1U6pT5laGHxIonFxH9TXyqJuGKUQj/w26yE0pixCEvqzTf1d3Yi6 RcSbcEInj/uwD5Jwaz1E5+pZ8tXyN6x1U+reFvAg7oKWECIPZpmxnLZOlMCNCYH6Wd9a 8sO8HgNvts59iexRCPFK9XlVX573o06zpoPmUde3CtBiBztkYtx/eDfXlnHsm3ZppfHu J2zg== X-Gm-Message-State: AOAM533tAFX12AHx7Q0JoWdQfCG8qGcngZVS3D0eKfsYhbFrm/NAA1/A QtU5dTRTafzUYQ3ZJEPvW/galkTGeqtCu/NJ9vQ= X-Google-Smtp-Source: ABdhPJxCl+vFpnD4+pHC1ZRtCJYoaz/ysBhS61vfXewSVTlzOYkxOqBr/JNTd+Ra+/skrEFl6OaFqQ== X-Received: by 2002:a05:6402:376:: with SMTP id s22mr12868841edw.27.1633520872276; Wed, 06 Oct 2021 04:47:52 -0700 (PDT) Received: from localhost.localdomain ([95.76.3.69]) by smtp.gmail.com with ESMTPSA id y40sm1402187ede.31.2021.10.06.04.47.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 04:47:51 -0700 (PDT) From: Leonard Crestez To: Jakub Kicinski , Shuah Khan , David Ahern Cc: "David S. Miller" , Ido Schimmel , Seth David Schoen , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 01/11] selftests: net/fcnal: Fix {ipv4,ipv6}_bind not run by default Date: Wed, 6 Oct 2021 14:47:17 +0300 Message-Id: <44c1cf86c0ff6390f438e307a6a956b554a90055.1633520807.git.cdleonard@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Inside the TESTS_IPV{4,6} array these are listed as ipv{4,6}_addr_bind but test running loop only checks for ipv{4,6}_bind and bind{,6} and ignores everything else. As a consequence these tests were not run by default, only with an explicit -t. Fix inside TESTS_IPV{4,6}. Signed-off-by: Leonard Crestez Reviewed-by: David Ahern --- tools/testing/selftests/net/fcnal-test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh index 13350cd5c8ac..2839bed91afa 100755 --- a/tools/testing/selftests/net/fcnal-test.sh +++ b/tools/testing/selftests/net/fcnal-test.sh @@ -3937,12 +3937,12 @@ EOF } ################################################################################ # main -TESTS_IPV4="ipv4_ping ipv4_tcp ipv4_udp ipv4_addr_bind ipv4_runtime ipv4_netfilter" -TESTS_IPV6="ipv6_ping ipv6_tcp ipv6_udp ipv6_addr_bind ipv6_runtime ipv6_netfilter" +TESTS_IPV4="ipv4_ping ipv4_tcp ipv4_udp ipv4_bind ipv4_runtime ipv4_netfilter" +TESTS_IPV6="ipv6_ping ipv6_tcp ipv6_udp ipv6_bind ipv6_runtime ipv6_netfilter" TESTS_OTHER="use_cases" PAUSE_ON_FAIL=no PAUSE=no From patchwork Wed Oct 6 11:47:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 12539311 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB3A3C433EF for ; Wed, 6 Oct 2021 11:48:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D32FC611C6 for ; Wed, 6 Oct 2021 11:48:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238366AbhJFLts (ORCPT ); Wed, 6 Oct 2021 07:49:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238341AbhJFLtr (ORCPT ); Wed, 6 Oct 2021 07:49:47 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04CEEC06174E; Wed, 6 Oct 2021 04:47:55 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id p11so8734749edy.10; Wed, 06 Oct 2021 04:47:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Kw3Ir5Gyq+D9F9tT/lLiOTdXEuPzQBCuLATIbYBfmVI=; b=dwY2KVF1HvyTa8h+U8S2GFBGu4Udoz3uDcf3mlLaxfmuiIz412ewVYPH/h8PjuKFnC Fow2I78Te2AXa+y86sgA1gFqxM+lFGG1jnD8KWWhsywG+i0zecNIzZeAkwGLVTwV+pDg o06tLE6SEIQQM8wGDjNEWs2dMQg8GQcOaqBcE2IAQ09QUBPC4Hoe/1+Zy0HLZy/d5Wjg 9q8wvjrwkvy8XncfWHZ+Ym/weRjzE7UYfDysPCP9Ew98fuUeK6QRDs034X0FEu/h92m2 EtUOo9YECudEgkUWUHPEL58IY3FbkKOOxi505MgyGd9iTuPnMEcQkWrH2CA10PSOAxAe L/0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Kw3Ir5Gyq+D9F9tT/lLiOTdXEuPzQBCuLATIbYBfmVI=; b=zSbWs1ESsaTK3xPxwnNnhiQ6tYhvA0dDU6vzDWvWMMmuxpxxshmMMMk/PBiva2dWeF 1+KvTWQlp4ATv2qwYO6HsykMrhBxUjUhU3g0svehimfyKgbiJ9qNaQEm00np6jCXqC+r c0Ye/vi7NT0MuGxKq6KbHdJsVDCAtiRW0uSwwE1PcKSwxOXvRPhG1aUlKobJwLbZIuRj Wiu6H/9CdYeieXgwjfVlIqwQZFMq2HEHhtsjwKSzHIa8kssKVT6dHA+q4qXrjHt3+3Ke zWam64LtZpWFRIpsGk2GKJlvEuX89bKNvaXv9ZwUdVtiWr0lKQiTL3ulmkX2tDPVwMDJ dyrQ== X-Gm-Message-State: AOAM5300gIlfbMhFxciYAHKm66DmD3i2arS54CfJPq9k0pINHqSRykPR HEFdEMmWJ4OcYyFqpB7zhCo= X-Google-Smtp-Source: ABdhPJxuA+vaE0UvBVgP8LaKn+wRg1iSIfy9Mpq4awfAyYp+9LJM1uJSyNm5MzA+IHt1kIyxtzl+6A== X-Received: by 2002:a17:906:2ccf:: with SMTP id r15mr23980620ejr.182.1633520873513; Wed, 06 Oct 2021 04:47:53 -0700 (PDT) Received: from localhost.localdomain ([95.76.3.69]) by smtp.gmail.com with ESMTPSA id y40sm1402187ede.31.2021.10.06.04.47.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 04:47:53 -0700 (PDT) From: Leonard Crestez To: Jakub Kicinski , Shuah Khan , David Ahern Cc: "David S. Miller" , Ido Schimmel , Seth David Schoen , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/11] selftests: net/fcnal: Mark unknown -t or TESTS value as error Date: Wed, 6 Oct 2021 14:47:18 +0300 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Right now unknown values are completely ignored which is very confusing and lead to a subset of tests being skipped because of a mispelling. Signed-off-by: Leonard Crestez Reviewed-by: David Ahern --- tools/testing/selftests/net/fcnal-test.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh index 2839bed91afa..43ea5c878a85 100755 --- a/tools/testing/selftests/net/fcnal-test.sh +++ b/tools/testing/selftests/net/fcnal-test.sh @@ -4005,10 +4005,13 @@ do # setup namespaces and config, but do not run any tests setup) setup; exit 0;; vrf_setup) setup "yes"; exit 0;; help) echo "Test names: $TESTS"; exit 0;; + *) + echo "Unknown test '$t'" + exit 1 esac done cleanup 2>/dev/null From patchwork Wed Oct 6 11:47:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 12539309 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0328EC433F5 for ; Wed, 6 Oct 2021 11:48:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E1D1361077 for ; Wed, 6 Oct 2021 11:48:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238432AbhJFLtw (ORCPT ); Wed, 6 Oct 2021 07:49:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238417AbhJFLtt (ORCPT ); Wed, 6 Oct 2021 07:49:49 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3F5BC061760; Wed, 6 Oct 2021 04:47:57 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id g10so8848194edj.1; Wed, 06 Oct 2021 04:47:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vvUDXRfQZSa/sD1uRH4Cu4LlbkozKmdcsriUWZz/OOk=; b=HwwJxf46zyePUemdn1L5zDaG+s2+3LcVZyR5YKrzlLuopAh9rPr1XWjHYXV0UfNsYM SwbinOo9o2E8ovGpVaFFm0+KNL1olzSz2No1p80h0z9dlsXHzgRoJObhb+eTb9ZrQhFu Rg+3O9FWx8nLyWCWVhRg2p2JUhdB0udtivkUmsVBOWDoZqcFf0a2pwA0cWdlE45l5TOx aEBMPkl8hh4YX8daRAuQ4EvmX11zWm44khPbu289NUXVuzaYEpsu/4GKdLiBuHZZQw71 zkSqV/jWihdwOjkfUa62hBLAc4SuQvKUjcSDl5uKDcY0Dkeecn/+Yy2Ois6o0U14dWZJ YfZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vvUDXRfQZSa/sD1uRH4Cu4LlbkozKmdcsriUWZz/OOk=; b=52j+zzaMTYILSt8ujB3/4reLUu1fXRGxfryFVWZHmyGXUWNC8AZ70Ib/ZmHAcY7KIV bQ0m+hLk+TJTgcnf6V+gaH1FsoZiQu2gVCfHpVMu32QRdLArFU8A1FPgizIc/QKs7vYK n9BSEIL0+RalwxX3OC3pLZH/ZO7hGGLvTGfWHZyf2Iv6fhdE+hoa1HDGadArNStioj58 FjVROoGrC0eJIgYsjWZ5WNGsYjgLFA8+kyvwX4OwmgIWoeFzO9zbBF2KoZ5onQO90qZC uODIKSMbIkCtGBmgRv9H2XgFXllabZmnlrm3plP+VkZeRkOD4R/w8KhKdj6BVwQPGt7B 2jgg== X-Gm-Message-State: AOAM532vzjLpt1fIkH/ZbeiMQxA1zGU/jpEP319rAVWTQyttFOok8Buk tTN4XgqLaK1QRlV1DXCtwCU= X-Google-Smtp-Source: ABdhPJzKV7RMnRPFCg1pvbi+bXRv7aY6VNydbcv3wVFCYgohiQzs2RCEJNXY0hhHvcX9CXKk+mJ8nA== X-Received: by 2002:a50:becf:: with SMTP id e15mr33689336edk.114.1633520874695; Wed, 06 Oct 2021 04:47:54 -0700 (PDT) Received: from localhost.localdomain ([95.76.3.69]) by smtp.gmail.com with ESMTPSA id y40sm1402187ede.31.2021.10.06.04.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 04:47:54 -0700 (PDT) From: Leonard Crestez To: Jakub Kicinski , Shuah Khan , David Ahern Cc: "David S. Miller" , Ido Schimmel , Seth David Schoen , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/11] selftests: net/fcnal: Non-zero exit on failures Date: Wed, 6 Oct 2021 14:47:19 +0300 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Test scripts must report 'pass' or 'fail' via exit status, not just logging. Signed-off-by: Leonard Crestez Reviewed-by: David Ahern --- tools/testing/selftests/net/fcnal-test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh index 43ea5c878a85..9cf05e6e0d9b 100755 --- a/tools/testing/selftests/net/fcnal-test.sh +++ b/tools/testing/selftests/net/fcnal-test.sh @@ -4015,5 +4015,6 @@ done cleanup 2>/dev/null printf "\nTests passed: %3d\n" ${nsuccess} printf "Tests failed: %3d\n" ${nfail} +exit $(( nfail != 0 )) From patchwork Wed Oct 6 11:47:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 12539313 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 123C5C433FE for ; Wed, 6 Oct 2021 11:48:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E6A156125F for ; Wed, 6 Oct 2021 11:48:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238475AbhJFLtx (ORCPT ); Wed, 6 Oct 2021 07:49:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238421AbhJFLtt (ORCPT ); Wed, 6 Oct 2021 07:49:49 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6BE2C061755; Wed, 6 Oct 2021 04:47:57 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id l7so8910332edq.3; Wed, 06 Oct 2021 04:47:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vxpCd9DTD+L+m0nuHZPiU7pujsT7ePOGVZipNpzzkmY=; b=p6kpuSLH5GrXiQRUm8Wc/iqauzF/veeUIu5HFE566yVmikcq5hglXUs7ocopJ0vnRS mhw6keP3Dq8CvMBj+dO878mmZfx5qvsPTOU+Xj5zCi33DsAliH0GcS/5sRG/zniUe1Rg tv8HL9ixJtqVp9jl4/UENVZessdweSwru0IbAvlA7WzFibYNNiMzWl7BDll0p+HJY/Dj ldae5XOL4rsSgrVTCW91PSSLjBjnRCy4Ckbz8j+hxMGq26aqlCuEZ4slFV0HNKgiYgS3 DCjfV+3BlJByPGxMBOcAgoIc98jifDPjs8+f+o+xgRM3vQSw51s1iNruBGBDbue8j7V/ cbeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vxpCd9DTD+L+m0nuHZPiU7pujsT7ePOGVZipNpzzkmY=; b=0TD6Uglwyh8GFYJ0td3h3x1OMrsCjW5f3IAldh037zRnK6FH40SmtTp7CyxSg/eiKm xTFW+Z5xBaKwGU48GgriD6pwdDI+uFO8WHTBUQm6A9MWXp2EXQ+zUvAqvem5Uw+FGXKH kFaNR4qEYC8H82gTu2/c6Xi+zckMOLPX9NaclzZOjEKAgRy0SKWknq9bD2R2cAhk2ZM9 0BKs1GCgSjFhNXAr+vnwvPSI39QIQNGmnbn1sS1x1S4yoF8dzz0+2g3iHmEICaUnzy/X 9CV7fMt5l4rHTo6nqLeIYpCygbG0WkuVOn9rkWoPpB0OhF1Rg7xpFNOa93MeijgItf2U k65w== X-Gm-Message-State: AOAM531+VN7DT+GEtYBki/7qzlgdrrfAdDR4689DUdCu9j8AA3ltcPP/ dMaD1d09vHcd9ZdqmkxB3iU= X-Google-Smtp-Source: ABdhPJzhk4wz5dmckehgAsLblKzEufbUhssl6KO70BsAGxHGOEwhZ4RqRrSeIeukS1gQD2mp6SRXaw== X-Received: by 2002:a17:906:3148:: with SMTP id e8mr31472956eje.240.1633520876292; Wed, 06 Oct 2021 04:47:56 -0700 (PDT) Received: from localhost.localdomain ([95.76.3.69]) by smtp.gmail.com with ESMTPSA id y40sm1402187ede.31.2021.10.06.04.47.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 04:47:55 -0700 (PDT) From: Leonard Crestez To: Jakub Kicinski , Shuah Khan , David Ahern Cc: "David S. Miller" , Ido Schimmel , Seth David Schoen , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/11] selftests: net/fcnal: Use accept_dad=0 to avoid setup sleep Date: Wed, 6 Oct 2021 14:47:20 +0300 Message-Id: <9cfeec9f336bf6f5fe06309526820e9bbbc87ea3.1633520807.git.cdleonard@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Duplicate Address Detection makes ipv6 addresses unavailable for a short period after adding (average about 1 second). Adding sleep statements avoid this but since all addresses in the test environment are controlled from the same source we can just disable DAD for the entire namespace. Unlike sprinkling nodad to all ipv6 address additions this also skips DAD for link-local-addresses. Signed-off-by: Leonard Crestez Reviewed-by: David Ahern --- tools/testing/selftests/net/fcnal-test.sh | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh index 9cf05e6e0d9b..0bd60cd3bc06 100755 --- a/tools/testing/selftests/net/fcnal-test.sh +++ b/tools/testing/selftests/net/fcnal-test.sh @@ -357,11 +357,11 @@ create_vrf() ip -netns ${ns} link set ${vrf} up ip -netns ${ns} route add vrf ${vrf} unreachable default metric 8192 ip -netns ${ns} -6 route add vrf ${vrf} unreachable default metric 8192 ip -netns ${ns} addr add 127.0.0.1/8 dev ${vrf} - ip -netns ${ns} -6 addr add ::1 dev ${vrf} nodad + ip -netns ${ns} -6 addr add ::1 dev ${vrf} if [ "${addr}" != "-" ]; then ip -netns ${ns} addr add dev ${vrf} ${addr} fi if [ "${addr6}" != "-" ]; then ip -netns ${ns} -6 addr add dev ${vrf} ${addr6} @@ -378,10 +378,11 @@ create_ns() local ns=$1 local addr=$2 local addr6=$3 ip netns add ${ns} + ip netns exec ${ns} sysctl -wq net.ipv6.conf.{all,default}.accept_dad=0 ip -netns ${ns} link set lo up if [ "${addr}" != "-" ]; then ip -netns ${ns} addr add dev lo ${addr} fi @@ -490,12 +491,10 @@ setup() # tell ns-B how to get to remote addresses of ns-A ip -netns ${NSB} ro add ${NSA_LO_IP}/32 via ${NSA_IP} dev ${NSB_DEV} ip -netns ${NSB} ro add ${NSA_LO_IP6}/128 via ${NSA_IP6} dev ${NSB_DEV} set +e - - sleep 1 } setup_lla_only() { # make sure we are starting with a clean slate @@ -520,12 +519,10 @@ setup_lla_only() create_vrf ${NSA} ${VRF} ${VRF_TABLE} "-" "-" ip -netns ${NSA} link set dev ${NSA_DEV} vrf ${VRF} ip -netns ${NSA} link set dev ${NSA_DEV2} vrf ${VRF} set +e - - sleep 1 } ################################################################################ # IPv4 @@ -3014,11 +3011,11 @@ ipv6_udp_novrf() sleep 1 run_cmd_nsb nettest -6 -D -r ${NSA_IP6} log_test $? 0 "UDP in - LLA to GUA" run_cmd_nsb ip -6 ro del ${NSA_IP6}/128 dev ${NSB_DEV} - run_cmd_nsb ip -6 addr add ${NSB_IP6}/64 dev ${NSB_DEV} nodad + run_cmd_nsb ip -6 addr add ${NSB_IP6}/64 dev ${NSB_DEV} } ipv6_udp_vrf() { local a @@ -3292,11 +3289,11 @@ ipv6_udp_vrf() sleep 1 run_cmd_nsb nettest -6 -D -r ${NSA_IP6} log_test $? 0 "UDP in - LLA to GUA" run_cmd_nsb ip -6 ro del ${NSA_IP6}/128 dev ${NSB_DEV} - run_cmd_nsb ip -6 addr add ${NSB_IP6}/64 dev ${NSB_DEV} nodad + run_cmd_nsb ip -6 addr add ${NSB_IP6}/64 dev ${NSB_DEV} } ipv6_udp() { # should not matter, but set to known state @@ -3742,11 +3739,11 @@ use_case_br() setup_cmd ip addr del dev ${NSA_DEV} ${NSA_IP}/24 setup_cmd ip -6 addr del dev ${NSA_DEV} ${NSA_IP6}/64 setup_cmd ip link add br0 type bridge setup_cmd ip addr add dev br0 ${NSA_IP}/24 - setup_cmd ip -6 addr add dev br0 ${NSA_IP6}/64 nodad + setup_cmd ip -6 addr add dev br0 ${NSA_IP6}/64 setup_cmd ip li set ${NSA_DEV} master br0 setup_cmd ip li set ${NSA_DEV} up setup_cmd ip li set br0 up setup_cmd ip li set br0 vrf ${VRF} @@ -3791,15 +3788,15 @@ use_case_br() setup_cmd ip li set br0 nomaster setup_cmd ip li add br0.100 link br0 type vlan id 100 setup_cmd ip li set br0.100 vrf ${VRF} up setup_cmd ip addr add dev br0.100 172.16.101.1/24 - setup_cmd ip -6 addr add dev br0.100 2001:db8:101::1/64 nodad + setup_cmd ip -6 addr add dev br0.100 2001:db8:101::1/64 setup_cmd_nsb ip li add vlan100 link ${NSB_DEV} type vlan id 100 setup_cmd_nsb ip addr add dev vlan100 172.16.101.2/24 - setup_cmd_nsb ip -6 addr add dev vlan100 2001:db8:101::2/64 nodad + setup_cmd_nsb ip -6 addr add dev vlan100 2001:db8:101::2/64 setup_cmd_nsb ip li set vlan100 up sleep 1 rmmod br_netfilter 2>/dev/null From patchwork Wed Oct 6 11:47:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 12539315 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2453EC433F5 for ; Wed, 6 Oct 2021 11:48:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0A60861131 for ; Wed, 6 Oct 2021 11:48:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238423AbhJFLt6 (ORCPT ); Wed, 6 Oct 2021 07:49:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238117AbhJFLtw (ORCPT ); Wed, 6 Oct 2021 07:49:52 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6562C061749; Wed, 6 Oct 2021 04:47:59 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id x7so8735714edd.6; Wed, 06 Oct 2021 04:47:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nhBac9ySmVQ5ir83z9Tad+wE2IbxDFGBb95nCedyfbc=; b=ai3V7nk4kDPh3m42WXc2Bnc0Ujz1eqivV3xMn88FKHju/se7c8psloCp9JI6CCnuwd IeKJ5NYdWcniRjfiiDEl9plJ07z95XJ5bB2MUyYZQS1S6MEwBYv8NGb1yGVYTCoOkkUs uzdX8wh+bzoiMxyG+ZQW28AtacxFWNqVUgZbtO9djd6HWbAkBLEazhIVSjmLzBVj+gTd Dwi6WbHwHH71IaebTPFet+eoT1RHCrxPQDNMSYvRgVn4PN0rRFwy8HkAtqmMAheoeDSy IqpeSumzDobbpqf9gegyvOu3RULolTNCSsESODMMd93eBIx+m3zeKdh7bZPuy2w/L2Ty zhEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nhBac9ySmVQ5ir83z9Tad+wE2IbxDFGBb95nCedyfbc=; b=iU+3j4IMzmgX7swokpHryiwTHUe/pwFhcWFaQKyccGNXsuCzWOw0Jj04yjeiyJtcc7 HLoJeKg5khB6Wem75foNdUI0TnrYkSMLqKJJsHODn+v1//q2QgmqaGdyIeJWQKfFnchS yvAbCIXzo/qat5zRCkUpoXSIwwlGPm67GWcqo3TAfYhQul5CT/jHpzxWPAdN3+eYkZnB NEUkGIS5oIJfqCAUKD7LiR6nBW0v4wzlctIpX3ajVTMJrvst1AsPLHLBFUYzDoDXxvro alpiwAOS3cVhcsGuN067ycEILAi15gki73EDZ6LO+BGmRxjkENNGhTIGi42KoVI+MQ5D TqLw== X-Gm-Message-State: AOAM532X8XxC/d19xgL9hysOVBHzwDhOq5JMGPYTDWT/8KcOQUObhfY5 gIRiil9z85werrLaJ/yY7bs= X-Google-Smtp-Source: ABdhPJwT7h8oyRpS0oK1rMDQvUm3a0FHWs1by1mkvq4CPDppdbl2/s5mPc9MGtGXBnQ7RdIEUL3fLQ== X-Received: by 2002:a50:da48:: with SMTP id a8mr33312528edk.146.1633520877446; Wed, 06 Oct 2021 04:47:57 -0700 (PDT) Received: from localhost.localdomain ([95.76.3.69]) by smtp.gmail.com with ESMTPSA id y40sm1402187ede.31.2021.10.06.04.47.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 04:47:57 -0700 (PDT) From: Leonard Crestez To: Jakub Kicinski , Shuah Khan , David Ahern Cc: "David S. Miller" , Ido Schimmel , Seth David Schoen , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 05/11] selftests: net/fcnal: kill_procs via spin instead of sleep Date: Wed, 6 Oct 2021 14:47:21 +0300 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Sleeping for one second after a kill is not necessary and adds up quite quickly. Replace with a fast loop spinning until pidof returns nothing. Signed-off-by: Leonard Crestez --- tools/testing/selftests/net/fcnal-test.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh index 0bd60cd3bc06..b7fda51deb3f 100755 --- a/tools/testing/selftests/net/fcnal-test.sh +++ b/tools/testing/selftests/net/fcnal-test.sh @@ -176,12 +176,19 @@ show_hint() fi } kill_procs() { - killall nettest ping ping6 >/dev/null 2>&1 - sleep 1 + local pids + while true; do + pids=$(pidof nettest ping ping6) + if [[ -z $pids ]]; then + break + fi + kill $pids + sleep 0.01 + done } do_run_cmd() { local cmd="$*" From patchwork Wed Oct 6 11:47:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 12539317 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2755CC433F5 for ; Wed, 6 Oct 2021 11:48:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1178861151 for ; Wed, 6 Oct 2021 11:48:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238454AbhJFLuD (ORCPT ); Wed, 6 Oct 2021 07:50:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238396AbhJFLtw (ORCPT ); Wed, 6 Oct 2021 07:49:52 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1472AC06174E; Wed, 6 Oct 2021 04:48:00 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id r18so8692232edv.12; Wed, 06 Oct 2021 04:47:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wI5DiihVmJ+5KuYm6tCIG9ONOUB+LjscGOui43RIXpU=; b=EQrLtCJ0BdXOj/yGCvpA/CfMvIrr3XJf+1lcHCpDPnN2XOWaGZ8T9hjQ1PLo5ui2Sp TnTHHMlj+/4aSvWfzZdVAV6OHQUfzzLdYpQgUZapmEtJBmcG+/Gl6J8TmcDWLlPITwhj d0NgQzF3KJjXiKOnEjX65+k1V9SnsIYhLWqomg/eQa2aAlNhvGd+mMzstOVcqeePv6iC mT3te+oCwBuT8wJ0V+uPAs5vPJ2HTNdS7b2fYRcw9ZDP84MVVIUQlZXdUqVPhU8qHYty VEas/1XyOXvSghJ8AN3y2KTR+KmxgXPfcN9K095HpP8Z11dGXYegiYGPUqfsEvh5lblS vKwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wI5DiihVmJ+5KuYm6tCIG9ONOUB+LjscGOui43RIXpU=; b=Sz/kcUwjlwnuINKit0RJWcmQSu85sf8mHQjGg+cFIsaquk2mTed8ZjCp9DZ0mUwceL 4GqX/i8m6aKfsez9M3avjI5RwnMlvLYOzRgw5navPufbcSYC92kwOK0xxkOAtHNsJVga epR+rAe6u8S8cJgXTDE6gO1rhJ+2HpkucSP681dggFbFbJx1zsPP3Mjtp8agSrwPeCVc t7MWTW9FvHHhDdStsQLJBn91xcgs2IG9yb+BF3SEScA6TW3TelqsQQM+rYDQg9Hd0pud vPitvcOwUc9g1MgBv/x6VtItfqZ6DvHZTm0n2ZP82m7dgDWZS+oM4KyCsW5OQtSYzqjw sIWA== X-Gm-Message-State: AOAM532qaZ2JNciUCVzQwJrVpiQ8s3vzb/gVIlh+KITJdGiig8XMjHcE NqVDxNxUvqMdM6ct2twu6NY= X-Google-Smtp-Source: ABdhPJxC1BJosrqzAbmMcTSbLoOUX3jJzDcKGj/BxHfnSm2b9OKM/RU0u1RVFReoDP8vOHQvxkNDfQ== X-Received: by 2002:a05:6402:1a3a:: with SMTP id be26mr33649619edb.356.1633520878648; Wed, 06 Oct 2021 04:47:58 -0700 (PDT) Received: from localhost.localdomain ([95.76.3.69]) by smtp.gmail.com with ESMTPSA id y40sm1402187ede.31.2021.10.06.04.47.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 04:47:58 -0700 (PDT) From: Leonard Crestez To: Jakub Kicinski , Shuah Khan , David Ahern Cc: "David S. Miller" , Ido Schimmel , Seth David Schoen , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/11] selftests: net/fcnal: Do not capture do_run_cmd in verbose mode Date: Wed, 6 Oct 2021 14:47:22 +0300 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org This way running with -v will show interspersed output from both nettest client and server. This helps to identify the order of events. It is also required in order to make nettest fork in the background by itself because shell capturing does not stop if the target forks. This also fixes SC2166 warning: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. Signed-off-by: Leonard Crestez Reviewed-by: David Ahern --- tools/testing/selftests/net/fcnal-test.sh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh index b7fda51deb3f..09cb35e16219 100755 --- a/tools/testing/selftests/net/fcnal-test.sh +++ b/tools/testing/selftests/net/fcnal-test.sh @@ -189,21 +189,19 @@ kill_procs() done } do_run_cmd() { - local cmd="$*" - local out + local rc cmd="$*" - if [ "$VERBOSE" = "1" ]; then + if [[ "$VERBOSE" = "1" ]]; then echo "COMMAND: ${cmd}" - fi - - out=$($cmd 2>&1) - rc=$? - if [ "$VERBOSE" = "1" -a -n "$out" ]; then - echo "$out" + $cmd + rc=$? + else + $cmd &> /dev/null + rc=$? fi return $rc } From patchwork Wed Oct 6 11:47:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 12539319 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD5DCC433FE for ; Wed, 6 Oct 2021 11:48:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C94E461131 for ; Wed, 6 Oct 2021 11:48:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238409AbhJFLuI (ORCPT ); Wed, 6 Oct 2021 07:50:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238345AbhJFLt4 (ORCPT ); Wed, 6 Oct 2021 07:49:56 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BC59C061767; Wed, 6 Oct 2021 04:48:01 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id b8so8904935edk.2; Wed, 06 Oct 2021 04:48:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V+ouzVHY1tKwbsTAOsFU9MaQhJWVSywu54+Kl5C21BA=; b=RheMnFUJ3nYggT0gxdozsswRrB0j0CyuGqs1KUrfgo1fN1F3kxviqwOWgxANxjSpFl G8ml1ecv9xYq3qgbMc5wBseV3wPN3r7Z7NA/n3Hjq5mPZV7gqKY/uLN76z8AXSvNg8J2 MpQByNysZwe1cRQnAjJDRd9qIsjMQX3D8RmakRsQrkP4BshcX/rklab/M8e6hXUUoVsd 5qKZ72Nxck+UX25qZWVmFB5vXZM8LHk3cvT1M4EV8GYCPesIKYD7KV7Mz3lIBMDvBhfs k5QoXvKnN1YUFdJvsDRSwqZEV9RhKIYl0gMUGQCd1EDWCVHnxGESCnyKRZkuwT2QKdkM jmxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V+ouzVHY1tKwbsTAOsFU9MaQhJWVSywu54+Kl5C21BA=; b=Kf5TistojRKe/CTM7FzqSIDU6X6lVyNUunijjiEbTJVy6MT5mYB7RFTsGnVILK1G5Y yygqdiBL3CHlKCTOKmTIa9phIQwoPLUUkNCEj/9oxinYm18jPfxhY3OxTXhs/IJ9jed3 m5NkQteKtiTDZtZQqATANCyeSxSnVurH4XwBFJpNNMt8Thn6zJGhKCAhmkWhu0fHvk9r /4SsZHNpYTLL7Llia8G6tELiyGQcMy84bxcJqV/PYhQTUTmnRUz7Tsuz5VTQHIjfujAp 7L4HJds3R+acAEAQpVEOP8VVFhGz+h/Zp23fojJhzJS967an3HlL3LT2IEaLzutC+Wgk LZ4g== X-Gm-Message-State: AOAM530VLy+6NoqOxlUH4p1CbxT55dgvJOn44xAM0/iWX2lF6xbE7tl2 MxTw/UDfbylTopNvPEOYou8= X-Google-Smtp-Source: ABdhPJy2m44sIK+eTQjGftlZctPgjwjgMX+E2x3LdMbcnj+3UrZBE1BhNq69uAgLI6qobd8SSNobdQ== X-Received: by 2002:a50:bf08:: with SMTP id f8mr32548383edk.400.1633520880040; Wed, 06 Oct 2021 04:48:00 -0700 (PDT) Received: from localhost.localdomain ([95.76.3.69]) by smtp.gmail.com with ESMTPSA id y40sm1402187ede.31.2021.10.06.04.47.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 04:47:59 -0700 (PDT) From: Leonard Crestez To: Jakub Kicinski , Shuah Khan , David Ahern Cc: "David S. Miller" , Ido Schimmel , Seth David Schoen , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 07/11] selftests: nettest: Implement -k to fork after bind or listen Date: Wed, 6 Oct 2021 14:47:23 +0300 Message-Id: <6c035c083cedd0ccf06932344d33c867763d6762.1633520807.git.cdleonard@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The fcnal-test.sh script launches the nettest server in the background and sleeps for 1 second to ensure that it has time to get up. Add an option to nettest to fork into the background as soon as packets are accepted by the kernel, this means bind() for datagrams or listen() for TCP. Signed-off-by: Leonard Crestez --- tools/testing/selftests/net/nettest.c | 34 ++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/nettest.c b/tools/testing/selftests/net/nettest.c index bd6288302094..576d8bb4c94c 100644 --- a/tools/testing/selftests/net/nettest.c +++ b/tools/testing/selftests/net/nettest.c @@ -73,10 +73,11 @@ struct sock_args { unsigned int has_local_ip:1, has_remote_ip:1, has_grp:1, has_expected_laddr:1, has_expected_raddr:1, + fork_background:1, bind_test_only:1; unsigned short port; int type; /* DGRAM, STREAM, RAW */ @@ -1388,10 +1389,29 @@ static int config_xfrm_policy(int sd, struct sock_args *args) } return 0; } +static void handle_fork_background(struct sock_args *args) +{ + pid_t fork_result; + int result; + + if (!args->fork_background) + return; + + fork_result = fork(); + if (fork_result) + exit(0); + result = setpgid(0, 0); + if (result) { + log_err_errno("Failed setpgid"); + exit(1); + } + log_msg("server running in background\n"); +} + static int lsock_init(struct sock_args *args) { long flags; int sd; @@ -1422,10 +1442,12 @@ static int lsock_init(struct sock_args *args) if (args->type == SOCK_STREAM && listen(sd, 1) < 0) { log_err_errno("listen failed"); goto err; } + handle_fork_background(args); + flags = fcntl(sd, F_GETFL); if ((flags < 0) || (fcntl(sd, F_SETFL, flags|O_NONBLOCK) < 0)) { log_err_errno("Failed to set non-blocking option"); goto err; } @@ -1819,11 +1841,11 @@ static int ipc_parent(int cpid, int fd, struct sock_args *args) wait(&status); return client_status; } -#define GETOPT_STR "sr:l:c:p:t:g:P:DRn:M:X:m:d:I:BN:O:SCi6xL:0:1:2:3:Fbq" +#define GETOPT_STR "sr:l:c:p:t:g:P:DRn:M:X:m:d:I:BN:O:SCi6xL:0:1:2:3:Fbqk" static void print_usage(char *prog) { printf( "usage: %s OPTS\n" @@ -1866,10 +1888,11 @@ static void print_usage(char *prog) " -2 dev Expected device name (or index) to receive packet\n" " -3 dev Expected device name (or index) to receive packets - server mode\n" "\n" " -b Bind test only.\n" " -q Be quiet. Run test without printing anything.\n" + " -k Fork server in background after bind or listen.\n" , prog, DEFAULT_PORT); } int main(int argc, char *argv[]) { @@ -2017,10 +2040,13 @@ int main(int argc, char *argv[]) quiet = 1; break; case 'x': args.use_xfrm = 1; break; + case 'k': + args.fork_background = 1; + break; default: print_usage(argv[0]); return 1; } } @@ -2058,10 +2084,16 @@ int main(int argc, char *argv[]) fprintf(stderr, "Local (server mode) or remote IP (client IP) required\n"); return 1; } + if (args.fork_background && (both_mode || !server_mode)) { + fprintf(stderr, + "Fork after listen only supported for server mode\n"); + return 1; + } + if (interactive) { prog_timeout = 0; msg = NULL; } From patchwork Wed Oct 6 11:47:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 12539321 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA679C433F5 for ; Wed, 6 Oct 2021 11:48:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A04B461154 for ; Wed, 6 Oct 2021 11:48:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238710AbhJFLuV (ORCPT ); Wed, 6 Oct 2021 07:50:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238586AbhJFLuC (ORCPT ); Wed, 6 Oct 2021 07:50:02 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AD20C06176C; Wed, 6 Oct 2021 04:48:03 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id f4so3430946edr.8; Wed, 06 Oct 2021 04:48:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=x/buBl4AuOHTTf2T2EtYPGmei4Zsgh/gX2u7OvPsDeQ=; b=QWp5NIXjPg70ai7Pwvbkba40OOmeeCA5+bDct2+UxMElXql1PMufvNuaJc/N5u/Kps 2cFLw2SjWwWsSr7o+RRzqG/yzKFId1jFqoe+aE4mwhTLCdNU98Zm3ea+bXZ3u2fQmLIZ h2kHuOtYNxH74BeYXe0jObCQ8RIWZd6o4BkFGYLubGlanaUvm5/ikIiV5oGwrFn/58cI B87HzVhnlhyKD/sF1i904+xWhFxElI7SIPZXT4JJZL3Gcprluvaauu5DzuFLVCeDbjOf IklZ0g0F/u/bf4ispGoNxIvHLJTMuzNmeT/FhKDidgsDcznehk4PHwZmzYrygWAxMGa/ 3IWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x/buBl4AuOHTTf2T2EtYPGmei4Zsgh/gX2u7OvPsDeQ=; b=OYuJ8FhY4W7V/GuJN8D7b64YGklOQACXhwTszFxIDSqx5Hm1CLcnCJ4a5yjcuv0bqe jMbgqqbbdHSrjodTsXnxmRFiaV/0o8BtsWJh1/SX30nfa5As18wc3alWoEqLVwPZdPL/ /EVmSBKAnWv9m2BqtHl8GrhC7RfJ5z3kAs+PJWyBzZFNPQ9iFLc4nwJisUJZYJlq2bOL 5Lk+45T02jZ8aqUMRzwSvTlXEu9sl18L5jjTbb9CShcgItvAMjf2U9KRQrzaWafbU5RE FQ23gmiXWG8qQUqf+uEP/m563X3SfHRxi3KGhrvxUbVaY2d057LjmrhelPV8bGpkCb4j TJ/A== X-Gm-Message-State: AOAM532aswMSlPvvTcGDsek0A2hN/fGNDtPfhs1T1W+REBLSCUWoppIA U3ZiS9AI0ArpUXRZxtx35MQ= X-Google-Smtp-Source: ABdhPJwFEBJ9PfUW9LCZW+MRTgVRObBZhLpB+kZCFZlpl/scUGJ9LpyhJU++kKKtXHCRCyYV0T40Xw== X-Received: by 2002:a05:6402:4305:: with SMTP id m5mr30754060edc.277.1633520881655; Wed, 06 Oct 2021 04:48:01 -0700 (PDT) Received: from localhost.localdomain ([95.76.3.69]) by smtp.gmail.com with ESMTPSA id y40sm1402187ede.31.2021.10.06.04.48.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 04:48:01 -0700 (PDT) From: Leonard Crestez To: Jakub Kicinski , Shuah Khan , David Ahern Cc: "David S. Miller" , Ido Schimmel , Seth David Schoen , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 08/11] selftests: net/fcnal: Replace sleep after server start with -k Date: Wed, 6 Oct 2021 14:47:24 +0300 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The -k switch makes the server fork into the background after the listen call is succesful, this can be used to replace most of the `sleep 1` statements in this script. Change performed with a vim command: s/nettest \(.*-s.*\) &\n\s*sleep 1\n/nettest \1 -k\r Signed-off-by: Leonard Crestez --- tools/testing/selftests/net/fcnal-test.sh | 641 ++++++++-------------- 1 file changed, 219 insertions(+), 422 deletions(-) diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh index 09cb35e16219..e73aeb3884c5 100755 --- a/tools/testing/selftests/net/fcnal-test.sh +++ b/tools/testing/selftests/net/fcnal-test.sh @@ -804,63 +804,56 @@ ipv4_tcp_md5_novrf() # single address # # basic use case log_start - run_cmd nettest -s -M ${MD5_PW} -m ${NSB_IP} & - sleep 1 + run_cmd nettest -s -M ${MD5_PW} -m ${NSB_IP} -k run_cmd_nsb nettest -r ${NSA_IP} -X ${MD5_PW} log_test $? 0 "MD5: Single address config" # client sends MD5, server not configured log_start show_hint "Should timeout due to MD5 mismatch" - run_cmd nettest -s & - sleep 1 + run_cmd nettest -s -k run_cmd_nsb nettest -r ${NSA_IP} -X ${MD5_PW} log_test $? 2 "MD5: Server no config, client uses password" # wrong password log_start show_hint "Should timeout since client uses wrong password" - run_cmd nettest -s -M ${MD5_PW} -m ${NSB_IP} & - sleep 1 + run_cmd nettest -s -M ${MD5_PW} -m ${NSB_IP} -k run_cmd_nsb nettest -r ${NSA_IP} -X ${MD5_WRONG_PW} log_test $? 2 "MD5: Client uses wrong password" # client from different address log_start show_hint "Should timeout due to MD5 mismatch" - run_cmd nettest -s -M ${MD5_PW} -m ${NSB_LO_IP} & - sleep 1 + run_cmd nettest -s -M ${MD5_PW} -m ${NSB_LO_IP} -k run_cmd_nsb nettest -r ${NSA_IP} -X ${MD5_PW} log_test $? 2 "MD5: Client address does not match address configured with password" # # MD5 extension - prefix length # # client in prefix log_start - run_cmd nettest -s -M ${MD5_PW} -m ${NS_NET} & - sleep 1 + run_cmd nettest -s -M ${MD5_PW} -m ${NS_NET} -k run_cmd_nsb nettest -r ${NSA_IP} -X ${MD5_PW} log_test $? 0 "MD5: Prefix config" # client in prefix, wrong password log_start show_hint "Should timeout since client uses wrong password" - run_cmd nettest -s -M ${MD5_PW} -m ${NS_NET} & - sleep 1 + run_cmd nettest -s -M ${MD5_PW} -m ${NS_NET} -k run_cmd_nsb nettest -r ${NSA_IP} -X ${MD5_WRONG_PW} log_test $? 2 "MD5: Prefix config, client uses wrong password" # client outside of prefix log_start show_hint "Should timeout due to MD5 mismatch" - run_cmd nettest -s -M ${MD5_PW} -m ${NS_NET} & - sleep 1 + run_cmd nettest -s -M ${MD5_PW} -m ${NS_NET} -k run_cmd_nsb nettest -c ${NSB_LO_IP} -r ${NSA_IP} -X ${MD5_PW} log_test $? 2 "MD5: Prefix config, client address not in configured prefix" } # @@ -872,127 +865,112 @@ ipv4_tcp_md5() # single address # # basic use case log_start - run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP} & - sleep 1 + run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP} -k run_cmd_nsb nettest -r ${NSA_IP} -X ${MD5_PW} log_test $? 0 "MD5: VRF: Single address config" # client sends MD5, server not configured log_start show_hint "Should timeout since server does not have MD5 auth" - run_cmd nettest -s -I ${VRF} & - sleep 1 + run_cmd nettest -s -I ${VRF} -k run_cmd_nsb nettest -r ${NSA_IP} -X ${MD5_PW} log_test $? 2 "MD5: VRF: Server no config, client uses password" # wrong password log_start show_hint "Should timeout since client uses wrong password" - run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP} & - sleep 1 + run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP} -k run_cmd_nsb nettest -r ${NSA_IP} -X ${MD5_WRONG_PW} log_test $? 2 "MD5: VRF: Client uses wrong password" # client from different address log_start show_hint "Should timeout since server config differs from client" - run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NSB_LO_IP} & - sleep 1 + run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NSB_LO_IP} -k run_cmd_nsb nettest -r ${NSA_IP} -X ${MD5_PW} log_test $? 2 "MD5: VRF: Client address does not match address configured with password" # # MD5 extension - prefix length # # client in prefix log_start - run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET} & - sleep 1 + run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET} -k run_cmd_nsb nettest -r ${NSA_IP} -X ${MD5_PW} log_test $? 0 "MD5: VRF: Prefix config" # client in prefix, wrong password log_start show_hint "Should timeout since client uses wrong password" - run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET} & - sleep 1 + run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET} -k run_cmd_nsb nettest -r ${NSA_IP} -X ${MD5_WRONG_PW} log_test $? 2 "MD5: VRF: Prefix config, client uses wrong password" # client outside of prefix log_start show_hint "Should timeout since client address is outside of prefix" - run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET} & - sleep 1 + run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET} -k run_cmd_nsb nettest -c ${NSB_LO_IP} -r ${NSA_IP} -X ${MD5_PW} log_test $? 2 "MD5: VRF: Prefix config, client address not in configured prefix" # # duplicate config between default VRF and a VRF # log_start - run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP} & - run_cmd nettest -s -M ${MD5_WRONG_PW} -m ${NSB_IP} & - sleep 1 + run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP} -k + run_cmd nettest -s -M ${MD5_WRONG_PW} -m ${NSB_IP} -k run_cmd_nsb nettest -r ${NSA_IP} -X ${MD5_PW} log_test $? 0 "MD5: VRF: Single address config in default VRF and VRF, conn in VRF" log_start - run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP} & - run_cmd nettest -s -M ${MD5_WRONG_PW} -m ${NSB_IP} & - sleep 1 + run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP} -k + run_cmd nettest -s -M ${MD5_WRONG_PW} -m ${NSB_IP} -k run_cmd_nsc nettest -r ${NSA_IP} -X ${MD5_WRONG_PW} log_test $? 0 "MD5: VRF: Single address config in default VRF and VRF, conn in default VRF" log_start show_hint "Should timeout since client in default VRF uses VRF password" - run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP} & - run_cmd nettest -s -M ${MD5_WRONG_PW} -m ${NSB_IP} & - sleep 1 + run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP} -k + run_cmd nettest -s -M ${MD5_WRONG_PW} -m ${NSB_IP} -k run_cmd_nsc nettest -r ${NSA_IP} -X ${MD5_PW} log_test $? 2 "MD5: VRF: Single address config in default VRF and VRF, conn in default VRF with VRF pw" log_start show_hint "Should timeout since client in VRF uses default VRF password" - run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP} & - run_cmd nettest -s -M ${MD5_WRONG_PW} -m ${NSB_IP} & - sleep 1 + run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP} -k + run_cmd nettest -s -M ${MD5_WRONG_PW} -m ${NSB_IP} -k run_cmd_nsb nettest -r ${NSA_IP} -X ${MD5_WRONG_PW} log_test $? 2 "MD5: VRF: Single address config in default VRF and VRF, conn in VRF with default VRF pw" log_start - run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET} & - run_cmd nettest -s -M ${MD5_WRONG_PW} -m ${NS_NET} & - sleep 1 + run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET} -k + run_cmd nettest -s -M ${MD5_WRONG_PW} -m ${NS_NET} -k run_cmd_nsb nettest -r ${NSA_IP} -X ${MD5_PW} log_test $? 0 "MD5: VRF: Prefix config in default VRF and VRF, conn in VRF" log_start - run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET} & - run_cmd nettest -s -M ${MD5_WRONG_PW} -m ${NS_NET} & - sleep 1 + run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET} -k + run_cmd nettest -s -M ${MD5_WRONG_PW} -m ${NS_NET} -k run_cmd_nsc nettest -r ${NSA_IP} -X ${MD5_WRONG_PW} log_test $? 0 "MD5: VRF: Prefix config in default VRF and VRF, conn in default VRF" log_start show_hint "Should timeout since client in default VRF uses VRF password" - run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET} & - run_cmd nettest -s -M ${MD5_WRONG_PW} -m ${NS_NET} & - sleep 1 + run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET} -k + run_cmd nettest -s -M ${MD5_WRONG_PW} -m ${NS_NET} -k run_cmd_nsc nettest -r ${NSA_IP} -X ${MD5_PW} log_test $? 2 "MD5: VRF: Prefix config in default VRF and VRF, conn in default VRF with VRF pw" log_start show_hint "Should timeout since client in VRF uses default VRF password" - run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET} & - run_cmd nettest -s -M ${MD5_WRONG_PW} -m ${NS_NET} & - sleep 1 + run_cmd nettest -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET} -k + run_cmd nettest -s -M ${MD5_WRONG_PW} -m ${NS_NET} -k run_cmd_nsb nettest -r ${NSA_IP} -X ${MD5_WRONG_PW} log_test $? 2 "MD5: VRF: Prefix config in default VRF and VRF, conn in VRF with default VRF pw" # # negative tests @@ -1015,20 +993,18 @@ ipv4_tcp_novrf() # server tests # for a in ${NSA_IP} ${NSA_LO_IP} do log_start - run_cmd nettest -s & - sleep 1 + run_cmd nettest -s -k run_cmd_nsb nettest -r ${a} log_test_addr ${a} $? 0 "Global server" done a=${NSA_IP} log_start - run_cmd nettest -s -I ${NSA_DEV} & - sleep 1 + run_cmd nettest -s -I ${NSA_DEV} -k run_cmd_nsb nettest -r ${a} log_test_addr ${a} $? 0 "Device server" # verify TCP reset sent and received for a in ${NSA_IP} ${NSA_LO_IP} @@ -1043,18 +1019,16 @@ ipv4_tcp_novrf() # client # for a in ${NSB_IP} ${NSB_LO_IP} do log_start - run_cmd_nsb nettest -s & - sleep 1 + run_cmd_nsb nettest -s -k run_cmd nettest -r ${a} -0 ${NSA_IP} log_test_addr ${a} $? 0 "Client" log_start - run_cmd_nsb nettest -s & - sleep 1 + run_cmd_nsb nettest -s -k run_cmd nettest -r ${a} -d ${NSA_DEV} log_test_addr ${a} $? 0 "Client, device bind" log_start show_hint "Should fail 'Connection refused'" @@ -1071,54 +1045,48 @@ ipv4_tcp_novrf() # local address tests # for a in ${NSA_IP} ${NSA_LO_IP} 127.0.0.1 do log_start - run_cmd nettest -s & - sleep 1 + run_cmd nettest -s -k run_cmd nettest -r ${a} -0 ${a} -1 ${a} log_test_addr ${a} $? 0 "Global server, local connection" done a=${NSA_IP} log_start - run_cmd nettest -s -I ${NSA_DEV} & - sleep 1 + run_cmd nettest -s -I ${NSA_DEV} -k run_cmd nettest -r ${a} -0 ${a} log_test_addr ${a} $? 0 "Device server, unbound client, local connection" for a in ${NSA_LO_IP} 127.0.0.1 do log_start show_hint "Should fail 'Connection refused' since addresses on loopback are out of device scope" - run_cmd nettest -s -I ${NSA_DEV} & - sleep 1 + run_cmd nettest -s -I ${NSA_DEV} -k run_cmd nettest -r ${a} log_test_addr ${a} $? 1 "Device server, unbound client, local connection" done a=${NSA_IP} log_start - run_cmd nettest -s & - sleep 1 + run_cmd nettest -s -k run_cmd nettest -r ${a} -0 ${a} -d ${NSA_DEV} log_test_addr ${a} $? 0 "Global server, device client, local connection" for a in ${NSA_LO_IP} 127.0.0.1 do log_start show_hint "Should fail 'No route to host' since addresses on loopback are out of device scope" - run_cmd nettest -s & - sleep 1 + run_cmd nettest -s -k run_cmd nettest -r ${a} -d ${NSA_DEV} log_test_addr ${a} $? 1 "Global server, device client, local connection" done a=${NSA_IP} log_start - run_cmd nettest -s -I ${NSA_DEV} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -s -I ${NSA_DEV} -3 ${NSA_DEV} -k run_cmd nettest -d ${NSA_DEV} -r ${a} -0 ${a} log_test_addr ${a} $? 0 "Device server, device client, local connection" log_start show_hint "Should fail 'Connection refused'" @@ -1142,24 +1110,21 @@ ipv4_tcp_vrf() # for a in ${NSA_IP} ${VRF_IP} do log_start show_hint "Should fail 'Connection refused' since global server with VRF is disabled" - run_cmd nettest -s & - sleep 1 + run_cmd nettest -s -k run_cmd_nsb nettest -r ${a} log_test_addr ${a} $? 1 "Global server" log_start - run_cmd nettest -s -I ${VRF} -3 ${VRF} & - sleep 1 + run_cmd nettest -s -I ${VRF} -3 ${VRF} -k run_cmd_nsb nettest -r ${a} log_test_addr ${a} $? 0 "VRF server" log_start - run_cmd nettest -s -I ${NSA_DEV} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -s -I ${NSA_DEV} -3 ${NSA_DEV} -k run_cmd_nsb nettest -r ${a} log_test_addr ${a} $? 0 "Device server" # verify TCP reset received log_start @@ -1171,12 +1136,11 @@ ipv4_tcp_vrf() # local address tests # (${VRF_IP} and 127.0.0.1 both timeout) a=${NSA_IP} log_start show_hint "Should fail 'Connection refused' since global server with VRF is disabled" - run_cmd nettest -s & - sleep 1 + run_cmd nettest -s -k run_cmd nettest -r ${a} -d ${NSA_DEV} log_test_addr ${a} $? 1 "Global server, local connection" # run MD5 tests ipv4_tcp_md5 @@ -1189,19 +1153,17 @@ ipv4_tcp_vrf() for a in ${NSA_IP} ${VRF_IP} do log_start show_hint "client socket should be bound to VRF" - run_cmd nettest -s -3 ${VRF} & - sleep 1 + run_cmd nettest -s -3 ${VRF} -k run_cmd_nsb nettest -r ${a} log_test_addr ${a} $? 0 "Global server" log_start show_hint "client socket should be bound to VRF" - run_cmd nettest -s -I ${VRF} -3 ${VRF} & - sleep 1 + run_cmd nettest -s -I ${VRF} -3 ${VRF} -k run_cmd_nsb nettest -r ${a} log_test_addr ${a} $? 0 "VRF server" # verify TCP reset received log_start @@ -1211,40 +1173,36 @@ ipv4_tcp_vrf() done a=${NSA_IP} log_start show_hint "client socket should be bound to device" - run_cmd nettest -s -I ${NSA_DEV} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -s -I ${NSA_DEV} -3 ${NSA_DEV} -k run_cmd_nsb nettest -r ${a} log_test_addr ${a} $? 0 "Device server" # local address tests for a in ${NSA_IP} ${VRF_IP} do log_start show_hint "Should fail 'Connection refused' since client is not bound to VRF" - run_cmd nettest -s -I ${VRF} & - sleep 1 + run_cmd nettest -s -I ${VRF} -k run_cmd nettest -r ${a} log_test_addr ${a} $? 1 "Global server, local connection" done # # client # for a in ${NSB_IP} ${NSB_LO_IP} do log_start - run_cmd_nsb nettest -s & - sleep 1 + run_cmd_nsb nettest -s -k run_cmd nettest -r ${a} -d ${VRF} log_test_addr ${a} $? 0 "Client, VRF bind" log_start - run_cmd_nsb nettest -s & - sleep 1 + run_cmd_nsb nettest -s -k run_cmd nettest -r ${a} -d ${NSA_DEV} log_test_addr ${a} $? 0 "Client, device bind" log_start show_hint "Should fail 'Connection refused'" @@ -1258,39 +1216,34 @@ ipv4_tcp_vrf() done for a in ${NSA_IP} ${VRF_IP} 127.0.0.1 do log_start - run_cmd nettest -s -I ${VRF} -3 ${VRF} & - sleep 1 + run_cmd nettest -s -I ${VRF} -3 ${VRF} -k run_cmd nettest -r ${a} -d ${VRF} -0 ${a} log_test_addr ${a} $? 0 "VRF server, VRF client, local connection" done a=${NSA_IP} log_start - run_cmd nettest -s -I ${VRF} -3 ${VRF} & - sleep 1 + run_cmd nettest -s -I ${VRF} -3 ${VRF} -k run_cmd nettest -r ${a} -d ${NSA_DEV} -0 ${a} log_test_addr ${a} $? 0 "VRF server, device client, local connection" log_start show_hint "Should fail 'No route to host' since client is out of VRF scope" - run_cmd nettest -s -I ${VRF} & - sleep 1 + run_cmd nettest -s -I ${VRF} -k run_cmd nettest -r ${a} log_test_addr ${a} $? 1 "VRF server, unbound client, local connection" log_start - run_cmd nettest -s -I ${NSA_DEV} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -s -I ${NSA_DEV} -3 ${NSA_DEV} -k run_cmd nettest -r ${a} -d ${VRF} -0 ${a} log_test_addr ${a} $? 0 "Device server, VRF client, local connection" log_start - run_cmd nettest -s -I ${NSA_DEV} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -s -I ${NSA_DEV} -3 ${NSA_DEV} -k run_cmd nettest -r ${a} -d ${NSA_DEV} -0 ${a} log_test_addr ${a} $? 0 "Device server, device client, local connection" } ipv4_tcp() @@ -1324,12 +1277,11 @@ ipv4_udp_novrf() # server tests # for a in ${NSA_IP} ${NSA_LO_IP} do log_start - run_cmd nettest -D -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -D -s -3 ${NSA_DEV} -k run_cmd_nsb nettest -D -r ${a} log_test_addr ${a} $? 0 "Global server" log_start show_hint "Should fail 'Connection refused' since there is no server" @@ -1337,41 +1289,36 @@ ipv4_udp_novrf() log_test_addr ${a} $? 1 "No server" done a=${NSA_IP} log_start - run_cmd nettest -D -I ${NSA_DEV} -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -D -I ${NSA_DEV} -s -3 ${NSA_DEV} -k run_cmd_nsb nettest -D -r ${a} log_test_addr ${a} $? 0 "Device server" # # client # for a in ${NSB_IP} ${NSB_LO_IP} do log_start - run_cmd_nsb nettest -D -s & - sleep 1 + run_cmd_nsb nettest -D -s -k run_cmd nettest -D -r ${a} -0 ${NSA_IP} log_test_addr ${a} $? 0 "Client" log_start - run_cmd_nsb nettest -D -s & - sleep 1 + run_cmd_nsb nettest -D -s -k run_cmd nettest -D -r ${a} -d ${NSA_DEV} -0 ${NSA_IP} log_test_addr ${a} $? 0 "Client, device bind" log_start - run_cmd_nsb nettest -D -s & - sleep 1 + run_cmd_nsb nettest -D -s -k run_cmd nettest -D -r ${a} -d ${NSA_DEV} -C -0 ${NSA_IP} log_test_addr ${a} $? 0 "Client, device send via cmsg" log_start - run_cmd_nsb nettest -D -s & - sleep 1 + run_cmd_nsb nettest -D -s -k run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S -0 ${NSA_IP} log_test_addr ${a} $? 0 "Client, device bind via IP_UNICAST_IF" log_start show_hint "Should fail 'Connection refused'" @@ -1388,83 +1335,73 @@ ipv4_udp_novrf() # local address tests # for a in ${NSA_IP} ${NSA_LO_IP} 127.0.0.1 do log_start - run_cmd nettest -D -s & - sleep 1 + run_cmd nettest -D -s -k run_cmd nettest -D -r ${a} -0 ${a} -1 ${a} log_test_addr ${a} $? 0 "Global server, local connection" done a=${NSA_IP} log_start - run_cmd nettest -s -D -I ${NSA_DEV} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -s -D -I ${NSA_DEV} -3 ${NSA_DEV} -k run_cmd nettest -D -r ${a} log_test_addr ${a} $? 0 "Device server, unbound client, local connection" for a in ${NSA_LO_IP} 127.0.0.1 do log_start show_hint "Should fail 'Connection refused' since address is out of device scope" - run_cmd nettest -s -D -I ${NSA_DEV} & - sleep 1 + run_cmd nettest -s -D -I ${NSA_DEV} -k run_cmd nettest -D -r ${a} log_test_addr ${a} $? 1 "Device server, unbound client, local connection" done a=${NSA_IP} log_start - run_cmd nettest -s -D & - sleep 1 + run_cmd nettest -s -D -k run_cmd nettest -D -d ${NSA_DEV} -r ${a} log_test_addr ${a} $? 0 "Global server, device client, local connection" log_start - run_cmd nettest -s -D & - sleep 1 + run_cmd nettest -s -D -k run_cmd nettest -D -d ${NSA_DEV} -C -r ${a} log_test_addr ${a} $? 0 "Global server, device send via cmsg, local connection" log_start - run_cmd nettest -s -D & - sleep 1 + run_cmd nettest -s -D -k run_cmd nettest -D -d ${NSA_DEV} -S -r ${a} log_test_addr ${a} $? 0 "Global server, device client via IP_UNICAST_IF, local connection" # IPv4 with device bind has really weird behavior - it overrides the # fib lookup, generates an rtable and tries to send the packet. This # causes failures for local traffic at different places for a in ${NSA_LO_IP} 127.0.0.1 do log_start show_hint "Should fail since addresses on loopback are out of device scope" - run_cmd nettest -D -s & - sleep 1 + run_cmd nettest -D -s -k run_cmd nettest -D -r ${a} -d ${NSA_DEV} log_test_addr ${a} $? 2 "Global server, device client, local connection" log_start show_hint "Should fail since addresses on loopback are out of device scope" - run_cmd nettest -D -s & - sleep 1 + run_cmd nettest -D -s -k run_cmd nettest -D -r ${a} -d ${NSA_DEV} -C log_test_addr ${a} $? 1 "Global server, device send via cmsg, local connection" log_start show_hint "Should fail since addresses on loopback are out of device scope" - run_cmd nettest -D -s & - sleep 1 + run_cmd nettest -D -s -k run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection" done a=${NSA_IP} log_start - run_cmd nettest -D -s -I ${NSA_DEV} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -D -s -I ${NSA_DEV} -3 ${NSA_DEV} -k run_cmd nettest -D -d ${NSA_DEV} -r ${a} -0 ${a} log_test_addr ${a} $? 0 "Device server, device client, local conn" log_start run_cmd nettest -D -d ${NSA_DEV} -r ${a} @@ -1484,63 +1421,55 @@ ipv4_udp_vrf() # for a in ${NSA_IP} ${VRF_IP} do log_start show_hint "Fails because ingress is in a VRF and global server is disabled" - run_cmd nettest -D -s & - sleep 1 + run_cmd nettest -D -s -k run_cmd_nsb nettest -D -r ${a} log_test_addr ${a} $? 1 "Global server" log_start - run_cmd nettest -D -I ${VRF} -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -D -I ${VRF} -s -3 ${NSA_DEV} -k run_cmd_nsb nettest -D -r ${a} log_test_addr ${a} $? 0 "VRF server" log_start - run_cmd nettest -D -I ${NSA_DEV} -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -D -I ${NSA_DEV} -s -3 ${NSA_DEV} -k run_cmd_nsb nettest -D -r ${a} log_test_addr ${a} $? 0 "Enslaved device server" log_start show_hint "Should fail 'Connection refused' since there is no server" run_cmd_nsb nettest -D -r ${a} log_test_addr ${a} $? 1 "No server" log_start show_hint "Should fail 'Connection refused' since global server is out of scope" - run_cmd nettest -D -s & - sleep 1 + run_cmd nettest -D -s -k run_cmd nettest -D -d ${VRF} -r ${a} log_test_addr ${a} $? 1 "Global server, VRF client, local connection" done a=${NSA_IP} log_start - run_cmd nettest -s -D -I ${VRF} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -s -D -I ${VRF} -3 ${NSA_DEV} -k run_cmd nettest -D -d ${VRF} -r ${a} log_test_addr ${a} $? 0 "VRF server, VRF client, local conn" log_start - run_cmd nettest -s -D -I ${VRF} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -s -D -I ${VRF} -3 ${NSA_DEV} -k run_cmd nettest -D -d ${NSA_DEV} -r ${a} log_test_addr ${a} $? 0 "VRF server, enslaved device client, local connection" a=${NSA_IP} log_start - run_cmd nettest -s -D -I ${NSA_DEV} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -s -D -I ${NSA_DEV} -3 ${NSA_DEV} -k run_cmd nettest -D -d ${VRF} -r ${a} log_test_addr ${a} $? 0 "Enslaved device server, VRF client, local conn" log_start - run_cmd nettest -s -D -I ${NSA_DEV} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -s -D -I ${NSA_DEV} -3 ${NSA_DEV} -k run_cmd nettest -D -d ${NSA_DEV} -r ${a} log_test_addr ${a} $? 0 "Enslaved device server, device client, local conn" # enable global server log_subsection "Global server enabled" @@ -1550,24 +1479,21 @@ ipv4_udp_vrf() # server tests # for a in ${NSA_IP} ${VRF_IP} do log_start - run_cmd nettest -D -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -D -s -3 ${NSA_DEV} -k run_cmd_nsb nettest -D -r ${a} log_test_addr ${a} $? 0 "Global server" log_start - run_cmd nettest -D -I ${VRF} -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -D -I ${VRF} -s -3 ${NSA_DEV} -k run_cmd_nsb nettest -D -r ${a} log_test_addr ${a} $? 0 "VRF server" log_start - run_cmd nettest -D -I ${NSA_DEV} -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -D -I ${NSA_DEV} -s -3 ${NSA_DEV} -k run_cmd_nsb nettest -D -r ${a} log_test_addr ${a} $? 0 "Enslaved device server" log_start show_hint "Should fail 'Connection refused'" @@ -1577,18 +1503,16 @@ ipv4_udp_vrf() # # client tests # log_start - run_cmd_nsb nettest -D -s & - sleep 1 + run_cmd_nsb nettest -D -s -k run_cmd nettest -d ${VRF} -D -r ${NSB_IP} -1 ${NSA_IP} log_test $? 0 "VRF client" log_start - run_cmd_nsb nettest -D -s & - sleep 1 + run_cmd_nsb nettest -D -s -k run_cmd nettest -d ${NSA_DEV} -D -r ${NSB_IP} -1 ${NSA_IP} log_test $? 0 "Enslaved device client" # negative test - should fail log_start @@ -1604,53 +1528,46 @@ ipv4_udp_vrf() # # local address tests # a=${NSA_IP} log_start - run_cmd nettest -D -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -D -s -3 ${NSA_DEV} -k run_cmd nettest -D -d ${VRF} -r ${a} log_test_addr ${a} $? 0 "Global server, VRF client, local conn" log_start - run_cmd nettest -s -D -I ${VRF} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -s -D -I ${VRF} -3 ${NSA_DEV} -k run_cmd nettest -D -d ${VRF} -r ${a} log_test_addr ${a} $? 0 "VRF server, VRF client, local conn" log_start - run_cmd nettest -s -D -I ${VRF} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -s -D -I ${VRF} -3 ${NSA_DEV} -k run_cmd nettest -D -d ${NSA_DEV} -r ${a} log_test_addr ${a} $? 0 "VRF server, device client, local conn" log_start - run_cmd nettest -s -D -I ${NSA_DEV} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -s -D -I ${NSA_DEV} -3 ${NSA_DEV} -k run_cmd nettest -D -d ${VRF} -r ${a} log_test_addr ${a} $? 0 "Enslaved device server, VRF client, local conn" log_start - run_cmd nettest -s -D -I ${NSA_DEV} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -s -D -I ${NSA_DEV} -3 ${NSA_DEV} -k run_cmd nettest -D -d ${NSA_DEV} -r ${a} log_test_addr ${a} $? 0 "Enslaved device server, device client, local conn" for a in ${VRF_IP} 127.0.0.1 do log_start - run_cmd nettest -D -s -3 ${VRF} & - sleep 1 + run_cmd nettest -D -s -3 ${VRF} -k run_cmd nettest -D -d ${VRF} -r ${a} log_test_addr ${a} $? 0 "Global server, VRF client, local conn" done for a in ${VRF_IP} 127.0.0.1 do log_start - run_cmd nettest -s -D -I ${VRF} -3 ${VRF} & - sleep 1 + run_cmd nettest -s -D -I ${VRF} -3 ${VRF} -k run_cmd nettest -D -d ${VRF} -r ${a} log_test_addr ${a} $? 0 "VRF server, VRF client, local conn" done # negative test - should fail @@ -1807,12 +1724,11 @@ ipv4_rt() # server tests # for a in ${NSA_IP} ${VRF_IP} do log_start - run_cmd nettest ${varg} -s & - sleep 1 + run_cmd nettest ${varg} -s -k run_cmd_nsb nettest ${varg} -r ${a} & sleep 3 run_cmd ip link del ${VRF} sleep 1 log_test_addr ${a} 0 0 "${desc}, global server" @@ -1821,12 +1737,11 @@ ipv4_rt() done for a in ${NSA_IP} ${VRF_IP} do log_start - run_cmd nettest ${varg} -s -I ${VRF} & - sleep 1 + run_cmd nettest ${varg} -s -I ${VRF} -k run_cmd_nsb nettest ${varg} -r ${a} & sleep 3 run_cmd ip link del ${VRF} sleep 1 log_test_addr ${a} 0 0 "${desc}, VRF server" @@ -1834,12 +1749,11 @@ ipv4_rt() setup ${with_vrf} done a=${NSA_IP} log_start - run_cmd nettest ${varg} -s -I ${NSA_DEV} & - sleep 1 + run_cmd nettest ${varg} -s -I ${NSA_DEV} -k run_cmd_nsb nettest ${varg} -r ${a} & sleep 3 run_cmd ip link del ${VRF} sleep 1 log_test_addr ${a} 0 0 "${desc}, enslaved device server" @@ -1848,23 +1762,21 @@ ipv4_rt() # # client test # log_start - run_cmd_nsb nettest ${varg} -s & - sleep 1 + run_cmd_nsb nettest ${varg} -s -k run_cmd nettest ${varg} -d ${VRF} -r ${NSB_IP} & sleep 3 run_cmd ip link del ${VRF} sleep 1 log_test_addr ${a} 0 0 "${desc}, VRF client" setup ${with_vrf} log_start - run_cmd_nsb nettest ${varg} -s & - sleep 1 + run_cmd_nsb nettest ${varg} -s -k run_cmd nettest ${varg} -d ${NSA_DEV} -r ${NSB_IP} & sleep 3 run_cmd ip link del ${VRF} sleep 1 log_test_addr ${a} 0 0 "${desc}, enslaved device client" @@ -1875,12 +1787,11 @@ ipv4_rt() # local address tests # for a in ${NSA_IP} ${VRF_IP} do log_start - run_cmd nettest ${varg} -s & - sleep 1 + run_cmd nettest ${varg} -s -k run_cmd nettest ${varg} -d ${VRF} -r ${a} & sleep 3 run_cmd ip link del ${VRF} sleep 1 log_test_addr ${a} 0 0 "${desc}, global server, VRF client, local" @@ -1889,12 +1800,11 @@ ipv4_rt() done for a in ${NSA_IP} ${VRF_IP} do log_start - run_cmd nettest ${varg} -I ${VRF} -s & - sleep 1 + run_cmd nettest ${varg} -I ${VRF} -s -k run_cmd nettest ${varg} -d ${VRF} -r ${a} & sleep 3 run_cmd ip link del ${VRF} sleep 1 log_test_addr ${a} 0 0 "${desc}, VRF server and client, local" @@ -1902,34 +1812,31 @@ ipv4_rt() setup ${with_vrf} done a=${NSA_IP} log_start - run_cmd nettest ${varg} -s & - sleep 1 + run_cmd nettest ${varg} -s -k run_cmd nettest ${varg} -d ${NSA_DEV} -r ${a} & sleep 3 run_cmd ip link del ${VRF} sleep 1 log_test_addr ${a} 0 0 "${desc}, global server, enslaved device client, local" setup ${with_vrf} log_start - run_cmd nettest ${varg} -I ${VRF} -s & - sleep 1 + run_cmd nettest ${varg} -I ${VRF} -s -k run_cmd nettest ${varg} -d ${NSA_DEV} -r ${a} & sleep 3 run_cmd ip link del ${VRF} sleep 1 log_test_addr ${a} 0 0 "${desc}, VRF server, enslaved device client, local" setup ${with_vrf} log_start - run_cmd nettest ${varg} -I ${NSA_DEV} -s & - sleep 1 + run_cmd nettest ${varg} -I ${NSA_DEV} -s -k run_cmd nettest ${varg} -d ${NSA_DEV} -r ${a} & sleep 3 run_cmd ip link del ${VRF} sleep 1 log_test_addr ${a} 0 0 "${desc}, enslaved device server and client, local" @@ -2268,63 +2175,56 @@ ipv6_tcp_md5_novrf() # single address # # basic use case log_start - run_cmd nettest -6 -s -M ${MD5_PW} -m ${NSB_IP6} & - sleep 1 + run_cmd nettest -6 -s -M ${MD5_PW} -m ${NSB_IP6} -k run_cmd_nsb nettest -6 -r ${NSA_IP6} -X ${MD5_PW} log_test $? 0 "MD5: Single address config" # client sends MD5, server not configured log_start show_hint "Should timeout due to MD5 mismatch" - run_cmd nettest -6 -s & - sleep 1 + run_cmd nettest -6 -s -k run_cmd_nsb nettest -6 -r ${NSA_IP6} -X ${MD5_PW} log_test $? 2 "MD5: Server no config, client uses password" # wrong password log_start show_hint "Should timeout since client uses wrong password" - run_cmd nettest -6 -s -M ${MD5_PW} -m ${NSB_IP6} & - sleep 1 + run_cmd nettest -6 -s -M ${MD5_PW} -m ${NSB_IP6} -k run_cmd_nsb nettest -6 -r ${NSA_IP6} -X ${MD5_WRONG_PW} log_test $? 2 "MD5: Client uses wrong password" # client from different address log_start show_hint "Should timeout due to MD5 mismatch" - run_cmd nettest -6 -s -M ${MD5_PW} -m ${NSB_LO_IP6} & - sleep 1 + run_cmd nettest -6 -s -M ${MD5_PW} -m ${NSB_LO_IP6} -k run_cmd_nsb nettest -6 -r ${NSA_IP6} -X ${MD5_PW} log_test $? 2 "MD5: Client address does not match address configured with password" # # MD5 extension - prefix length # # client in prefix log_start - run_cmd nettest -6 -s -M ${MD5_PW} -m ${NS_NET6} & - sleep 1 + run_cmd nettest -6 -s -M ${MD5_PW} -m ${NS_NET6} -k run_cmd_nsb nettest -6 -r ${NSA_IP6} -X ${MD5_PW} log_test $? 0 "MD5: Prefix config" # client in prefix, wrong password log_start show_hint "Should timeout since client uses wrong password" - run_cmd nettest -6 -s -M ${MD5_PW} -m ${NS_NET6} & - sleep 1 + run_cmd nettest -6 -s -M ${MD5_PW} -m ${NS_NET6} -k run_cmd_nsb nettest -6 -r ${NSA_IP6} -X ${MD5_WRONG_PW} log_test $? 2 "MD5: Prefix config, client uses wrong password" # client outside of prefix log_start show_hint "Should timeout due to MD5 mismatch" - run_cmd nettest -6 -s -M ${MD5_PW} -m ${NS_NET6} & - sleep 1 + run_cmd nettest -6 -s -M ${MD5_PW} -m ${NS_NET6} -k run_cmd_nsb nettest -6 -c ${NSB_LO_IP6} -r ${NSA_IP6} -X ${MD5_PW} log_test $? 2 "MD5: Prefix config, client address not in configured prefix" } # @@ -2336,127 +2236,112 @@ ipv6_tcp_md5() # single address # # basic use case log_start - run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP6} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP6} -k run_cmd_nsb nettest -6 -r ${NSA_IP6} -X ${MD5_PW} log_test $? 0 "MD5: VRF: Single address config" # client sends MD5, server not configured log_start show_hint "Should timeout since server does not have MD5 auth" - run_cmd nettest -6 -s -I ${VRF} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -k run_cmd_nsb nettest -6 -r ${NSA_IP6} -X ${MD5_PW} log_test $? 2 "MD5: VRF: Server no config, client uses password" # wrong password log_start show_hint "Should timeout since client uses wrong password" - run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP6} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP6} -k run_cmd_nsb nettest -6 -r ${NSA_IP6} -X ${MD5_WRONG_PW} log_test $? 2 "MD5: VRF: Client uses wrong password" # client from different address log_start show_hint "Should timeout since server config differs from client" - run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NSB_LO_IP6} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NSB_LO_IP6} -k run_cmd_nsb nettest -6 -r ${NSA_IP6} -X ${MD5_PW} log_test $? 2 "MD5: VRF: Client address does not match address configured with password" # # MD5 extension - prefix length # # client in prefix log_start - run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET6} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET6} -k run_cmd_nsb nettest -6 -r ${NSA_IP6} -X ${MD5_PW} log_test $? 0 "MD5: VRF: Prefix config" # client in prefix, wrong password log_start show_hint "Should timeout since client uses wrong password" - run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET6} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET6} -k run_cmd_nsb nettest -6 -r ${NSA_IP6} -X ${MD5_WRONG_PW} log_test $? 2 "MD5: VRF: Prefix config, client uses wrong password" # client outside of prefix log_start show_hint "Should timeout since client address is outside of prefix" - run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET6} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET6} -k run_cmd_nsb nettest -6 -c ${NSB_LO_IP6} -r ${NSA_IP6} -X ${MD5_PW} log_test $? 2 "MD5: VRF: Prefix config, client address not in configured prefix" # # duplicate config between default VRF and a VRF # log_start - run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP6} & - run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -m ${NSB_IP6} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP6} -k + run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -m ${NSB_IP6} -k run_cmd_nsb nettest -6 -r ${NSA_IP6} -X ${MD5_PW} log_test $? 0 "MD5: VRF: Single address config in default VRF and VRF, conn in VRF" log_start - run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP6} & - run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -m ${NSB_IP6} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP6} -k + run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -m ${NSB_IP6} -k run_cmd_nsc nettest -6 -r ${NSA_IP6} -X ${MD5_WRONG_PW} log_test $? 0 "MD5: VRF: Single address config in default VRF and VRF, conn in default VRF" log_start show_hint "Should timeout since client in default VRF uses VRF password" - run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP6} & - run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -m ${NSB_IP6} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP6} -k + run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -m ${NSB_IP6} -k run_cmd_nsc nettest -6 -r ${NSA_IP6} -X ${MD5_PW} log_test $? 2 "MD5: VRF: Single address config in default VRF and VRF, conn in default VRF with VRF pw" log_start show_hint "Should timeout since client in VRF uses default VRF password" - run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP6} & - run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -m ${NSB_IP6} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NSB_IP6} -k + run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -m ${NSB_IP6} -k run_cmd_nsb nettest -6 -r ${NSA_IP6} -X ${MD5_WRONG_PW} log_test $? 2 "MD5: VRF: Single address config in default VRF and VRF, conn in VRF with default VRF pw" log_start - run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET6} & - run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -m ${NS_NET6} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET6} -k + run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -m ${NS_NET6} -k run_cmd_nsb nettest -6 -r ${NSA_IP6} -X ${MD5_PW} log_test $? 0 "MD5: VRF: Prefix config in default VRF and VRF, conn in VRF" log_start - run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET6} & - run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -m ${NS_NET6} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET6} -k + run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -m ${NS_NET6} -k run_cmd_nsc nettest -6 -r ${NSA_IP6} -X ${MD5_WRONG_PW} log_test $? 0 "MD5: VRF: Prefix config in default VRF and VRF, conn in default VRF" log_start show_hint "Should timeout since client in default VRF uses VRF password" - run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET6} & - run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -m ${NS_NET6} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET6} -k + run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -m ${NS_NET6} -k run_cmd_nsc nettest -6 -r ${NSA_IP6} -X ${MD5_PW} log_test $? 2 "MD5: VRF: Prefix config in default VRF and VRF, conn in default VRF with VRF pw" log_start show_hint "Should timeout since client in VRF uses default VRF password" - run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET6} & - run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -m ${NS_NET6} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -M ${MD5_PW} -m ${NS_NET6} -k + run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -m ${NS_NET6} -k run_cmd_nsb nettest -6 -r ${NSA_IP6} -X ${MD5_WRONG_PW} log_test $? 2 "MD5: VRF: Prefix config in default VRF and VRF, conn in VRF with default VRF pw" # # negative tests @@ -2479,12 +2364,11 @@ ipv6_tcp_novrf() # server tests # for a in ${NSA_IP6} ${NSA_LO_IP6} ${NSA_LINKIP6}%${NSB_DEV} do log_start - run_cmd nettest -6 -s & - sleep 1 + run_cmd nettest -6 -s -k run_cmd_nsb nettest -6 -r ${a} log_test_addr ${a} $? 0 "Global server" done # verify TCP reset received @@ -2500,21 +2384,19 @@ ipv6_tcp_novrf() # client # for a in ${NSB_IP6} ${NSB_LO_IP6} ${NSB_LINKIP6}%${NSA_DEV} do log_start - run_cmd_nsb nettest -6 -s & - sleep 1 + run_cmd_nsb nettest -6 -s -k run_cmd nettest -6 -r ${a} log_test_addr ${a} $? 0 "Client" done for a in ${NSB_IP6} ${NSB_LO_IP6} ${NSB_LINKIP6}%${NSA_DEV} do log_start - run_cmd_nsb nettest -6 -s & - sleep 1 + run_cmd_nsb nettest -6 -s -k run_cmd nettest -6 -r ${a} -d ${NSA_DEV} log_test_addr ${a} $? 0 "Client, device bind" done for a in ${NSB_IP6} ${NSB_LO_IP6} ${NSB_LINKIP6}%${NSA_DEV} @@ -2529,55 +2411,49 @@ ipv6_tcp_novrf() # local address tests # for a in ${NSA_IP6} ${NSA_LO_IP6} ::1 do log_start - run_cmd nettest -6 -s & - sleep 1 + run_cmd nettest -6 -s -k run_cmd nettest -6 -r ${a} log_test_addr ${a} $? 0 "Global server, local connection" done a=${NSA_IP6} log_start - run_cmd nettest -6 -s -I ${NSA_DEV} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -s -I ${NSA_DEV} -3 ${NSA_DEV} -k run_cmd nettest -6 -r ${a} -0 ${a} log_test_addr ${a} $? 0 "Device server, unbound client, local connection" for a in ${NSA_LO_IP6} ::1 do log_start show_hint "Should fail 'Connection refused' since addresses on loopback are out of device scope" - run_cmd nettest -6 -s -I ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -s -I ${NSA_DEV} -k run_cmd nettest -6 -r ${a} log_test_addr ${a} $? 1 "Device server, unbound client, local connection" done a=${NSA_IP6} log_start - run_cmd nettest -6 -s & - sleep 1 + run_cmd nettest -6 -s -k run_cmd nettest -6 -r ${a} -d ${NSA_DEV} -0 ${a} log_test_addr ${a} $? 0 "Global server, device client, local connection" for a in ${NSA_LO_IP6} ::1 do log_start show_hint "Should fail 'Connection refused' since addresses on loopback are out of device scope" - run_cmd nettest -6 -s & - sleep 1 + run_cmd nettest -6 -s -k run_cmd nettest -6 -r ${a} -d ${NSA_DEV} log_test_addr ${a} $? 1 "Global server, device client, local connection" done for a in ${NSA_IP6} ${NSA_LINKIP6} do log_start - run_cmd nettest -6 -s -I ${NSA_DEV} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -s -I ${NSA_DEV} -3 ${NSA_DEV} -k run_cmd nettest -6 -d ${NSA_DEV} -r ${a} log_test_addr ${a} $? 0 "Device server, device client, local conn" done for a in ${NSA_IP6} ${NSA_LINKIP6} @@ -2605,38 +2481,34 @@ ipv6_tcp_vrf() # for a in ${NSA_IP6} ${VRF_IP6} ${NSA_LINKIP6}%${NSB_DEV} do log_start show_hint "Should fail 'Connection refused' since global server with VRF is disabled" - run_cmd nettest -6 -s & - sleep 1 + run_cmd nettest -6 -s -k run_cmd_nsb nettest -6 -r ${a} log_test_addr ${a} $? 1 "Global server" done for a in ${NSA_IP6} ${VRF_IP6} do log_start - run_cmd nettest -6 -s -I ${VRF} -3 ${VRF} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -3 ${VRF} -k run_cmd_nsb nettest -6 -r ${a} log_test_addr ${a} $? 0 "VRF server" done # link local is always bound to ingress device a=${NSA_LINKIP6}%${NSB_DEV} log_start - run_cmd nettest -6 -s -I ${VRF} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -3 ${NSA_DEV} -k run_cmd_nsb nettest -6 -r ${a} log_test_addr ${a} $? 0 "VRF server" for a in ${NSA_IP6} ${VRF_IP6} ${NSA_LINKIP6}%${NSB_DEV} do log_start - run_cmd nettest -6 -s -I ${NSA_DEV} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -s -I ${NSA_DEV} -3 ${NSA_DEV} -k run_cmd_nsb nettest -6 -r ${a} log_test_addr ${a} $? 0 "Device server" done # verify TCP reset received @@ -2650,12 +2522,11 @@ ipv6_tcp_vrf() # local address tests a=${NSA_IP6} log_start show_hint "Should fail 'Connection refused' since global server with VRF is disabled" - run_cmd nettest -6 -s & - sleep 1 + run_cmd nettest -6 -s -k run_cmd nettest -6 -r ${a} -d ${NSA_DEV} log_test_addr ${a} $? 1 "Global server, local connection" # run MD5 tests ipv6_tcp_md5 @@ -2667,44 +2538,39 @@ ipv6_tcp_vrf() set_sysctl net.ipv4.tcp_l3mdev_accept=1 for a in ${NSA_IP6} ${VRF_IP6} do log_start - run_cmd nettest -6 -s -3 ${VRF} & - sleep 1 + run_cmd nettest -6 -s -3 ${VRF} -k run_cmd_nsb nettest -6 -r ${a} log_test_addr ${a} $? 0 "Global server" done for a in ${NSA_IP6} ${VRF_IP6} do log_start - run_cmd nettest -6 -s -I ${VRF} -3 ${VRF} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -3 ${VRF} -k run_cmd_nsb nettest -6 -r ${a} log_test_addr ${a} $? 0 "VRF server" done # For LLA, child socket is bound to device a=${NSA_LINKIP6}%${NSB_DEV} log_start - run_cmd nettest -6 -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -s -3 ${NSA_DEV} -k run_cmd_nsb nettest -6 -r ${a} log_test_addr ${a} $? 0 "Global server" log_start - run_cmd nettest -6 -s -I ${VRF} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -3 ${NSA_DEV} -k run_cmd_nsb nettest -6 -r ${a} log_test_addr ${a} $? 0 "VRF server" for a in ${NSA_IP6} ${NSA_LINKIP6}%${NSB_DEV} do log_start - run_cmd nettest -6 -s -I ${NSA_DEV} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -s -I ${NSA_DEV} -3 ${NSA_DEV} -k run_cmd_nsb nettest -6 -r ${a} log_test_addr ${a} $? 0 "Device server" done # verify TCP reset received @@ -2719,12 +2585,11 @@ ipv6_tcp_vrf() # local address tests for a in ${NSA_IP6} ${VRF_IP6} do log_start show_hint "Fails 'Connection refused' since client is not in VRF" - run_cmd nettest -6 -s -I ${VRF} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -k run_cmd nettest -6 -r ${a} log_test_addr ${a} $? 1 "Global server, local connection" done @@ -2732,29 +2597,26 @@ ipv6_tcp_vrf() # client # for a in ${NSB_IP6} ${NSB_LO_IP6} do log_start - run_cmd_nsb nettest -6 -s & - sleep 1 + run_cmd_nsb nettest -6 -s -k run_cmd nettest -6 -r ${a} -d ${VRF} log_test_addr ${a} $? 0 "Client, VRF bind" done a=${NSB_LINKIP6} log_start show_hint "Fails since VRF device does not allow linklocal addresses" - run_cmd_nsb nettest -6 -s & - sleep 1 + run_cmd_nsb nettest -6 -s -k run_cmd nettest -6 -r ${a} -d ${VRF} log_test_addr ${a} $? 1 "Client, VRF bind" for a in ${NSB_IP6} ${NSB_LO_IP6} ${NSB_LINKIP6} do log_start - run_cmd_nsb nettest -6 -s & - sleep 1 + run_cmd_nsb nettest -6 -s -k run_cmd nettest -6 -r ${a} -d ${NSA_DEV} log_test_addr ${a} $? 0 "Client, device bind" done for a in ${NSB_IP6} ${NSB_LO_IP6} @@ -2774,42 +2636,37 @@ ipv6_tcp_vrf() done for a in ${NSA_IP6} ${VRF_IP6} ::1 do log_start - run_cmd nettest -6 -s -I ${VRF} -3 ${VRF} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -3 ${VRF} -k run_cmd nettest -6 -r ${a} -d ${VRF} -0 ${a} log_test_addr ${a} $? 0 "VRF server, VRF client, local connection" done a=${NSA_IP6} log_start - run_cmd nettest -6 -s -I ${VRF} -3 ${VRF} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -3 ${VRF} -k run_cmd nettest -6 -r ${a} -d ${NSA_DEV} -0 ${a} log_test_addr ${a} $? 0 "VRF server, device client, local connection" a=${NSA_IP6} log_start show_hint "Should fail since unbound client is out of VRF scope" - run_cmd nettest -6 -s -I ${VRF} & - sleep 1 + run_cmd nettest -6 -s -I ${VRF} -k run_cmd nettest -6 -r ${a} log_test_addr ${a} $? 1 "VRF server, unbound client, local connection" log_start - run_cmd nettest -6 -s -I ${NSA_DEV} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -s -I ${NSA_DEV} -3 ${NSA_DEV} -k run_cmd nettest -6 -r ${a} -d ${VRF} -0 ${a} log_test_addr ${a} $? 0 "Device server, VRF client, local connection" for a in ${NSA_IP6} ${NSA_LINKIP6} do log_start - run_cmd nettest -6 -s -I ${NSA_DEV} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -s -I ${NSA_DEV} -3 ${NSA_DEV} -k run_cmd nettest -6 -r ${a} -d ${NSA_DEV} -0 ${a} log_test_addr ${a} $? 0 "Device server, device client, local connection" done } @@ -2844,26 +2701,23 @@ ipv6_udp_novrf() # server tests # for a in ${NSA_IP6} ${NSA_LINKIP6}%${NSB_DEV} do log_start - run_cmd nettest -6 -D -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -D -s -3 ${NSA_DEV} -k run_cmd_nsb nettest -6 -D -r ${a} log_test_addr ${a} $? 0 "Global server" log_start - run_cmd nettest -6 -D -I ${NSA_DEV} -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -D -I ${NSA_DEV} -s -3 ${NSA_DEV} -k run_cmd_nsb nettest -6 -D -r ${a} log_test_addr ${a} $? 0 "Device server" done a=${NSA_LO_IP6} log_start - run_cmd nettest -6 -D -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -D -s -3 ${NSA_DEV} -k run_cmd_nsb nettest -6 -D -r ${a} log_test_addr ${a} $? 0 "Global server" # should fail since loopback address is out of scope for a device # bound server, but it does not - hence this is more documenting @@ -2888,30 +2742,26 @@ ipv6_udp_novrf() # client # for a in ${NSB_IP6} ${NSB_LO_IP6} ${NSB_LINKIP6}%${NSA_DEV} do log_start - run_cmd_nsb nettest -6 -D -s & - sleep 1 + run_cmd_nsb nettest -6 -D -s -k run_cmd nettest -6 -D -r ${a} -0 ${NSA_IP6} log_test_addr ${a} $? 0 "Client" log_start - run_cmd_nsb nettest -6 -D -s & - sleep 1 + run_cmd_nsb nettest -6 -D -s -k run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV} -0 ${NSA_IP6} log_test_addr ${a} $? 0 "Client, device bind" log_start - run_cmd_nsb nettest -6 -D -s & - sleep 1 + run_cmd_nsb nettest -6 -D -s -k run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV} -C -0 ${NSA_IP6} log_test_addr ${a} $? 0 "Client, device send via cmsg" log_start - run_cmd_nsb nettest -6 -D -s & - sleep 1 + run_cmd_nsb nettest -6 -D -s -k run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV} -S -0 ${NSA_IP6} log_test_addr ${a} $? 0 "Client, device bind via IPV6_UNICAST_IF" log_start show_hint "Should fail 'Connection refused'" @@ -2928,80 +2778,70 @@ ipv6_udp_novrf() # local address tests # for a in ${NSA_IP6} ${NSA_LO_IP6} ::1 do log_start - run_cmd nettest -6 -D -s & - sleep 1 + run_cmd nettest -6 -D -s -k run_cmd nettest -6 -D -r ${a} -0 ${a} -1 ${a} log_test_addr ${a} $? 0 "Global server, local connection" done a=${NSA_IP6} log_start - run_cmd nettest -6 -s -D -I ${NSA_DEV} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -s -D -I ${NSA_DEV} -3 ${NSA_DEV} -k run_cmd nettest -6 -D -r ${a} log_test_addr ${a} $? 0 "Device server, unbound client, local connection" for a in ${NSA_LO_IP6} ::1 do log_start show_hint "Should fail 'Connection refused' since address is out of device scope" - run_cmd nettest -6 -s -D -I ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -s -D -I ${NSA_DEV} -k run_cmd nettest -6 -D -r ${a} log_test_addr ${a} $? 1 "Device server, local connection" done a=${NSA_IP6} log_start - run_cmd nettest -6 -s -D & - sleep 1 + run_cmd nettest -6 -s -D -k run_cmd nettest -6 -D -d ${NSA_DEV} -r ${a} log_test_addr ${a} $? 0 "Global server, device client, local connection" log_start - run_cmd nettest -6 -s -D & - sleep 1 + run_cmd nettest -6 -s -D -k run_cmd nettest -6 -D -d ${NSA_DEV} -C -r ${a} log_test_addr ${a} $? 0 "Global server, device send via cmsg, local connection" log_start - run_cmd nettest -6 -s -D & - sleep 1 + run_cmd nettest -6 -s -D -k run_cmd nettest -6 -D -d ${NSA_DEV} -S -r ${a} log_test_addr ${a} $? 0 "Global server, device client via IPV6_UNICAST_IF, local connection" for a in ${NSA_LO_IP6} ::1 do log_start show_hint "Should fail 'No route to host' since addresses on loopback are out of device scope" - run_cmd nettest -6 -D -s & - sleep 1 + run_cmd nettest -6 -D -s -k run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV} log_test_addr ${a} $? 1 "Global server, device client, local connection" log_start show_hint "Should fail 'No route to host' since addresses on loopback are out of device scope" - run_cmd nettest -6 -D -s & - sleep 1 + run_cmd nettest -6 -D -s -k run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV} -C log_test_addr ${a} $? 1 "Global server, device send via cmsg, local connection" log_start show_hint "Should fail 'No route to host' since addresses on loopback are out of device scope" - run_cmd nettest -6 -D -s & - sleep 1 + run_cmd nettest -6 -D -s -k run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV} -S log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection" done a=${NSA_IP6} log_start - run_cmd nettest -6 -D -s -I ${NSA_DEV} -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -D -s -I ${NSA_DEV} -3 ${NSA_DEV} -k run_cmd nettest -6 -D -d ${NSA_DEV} -r ${a} -0 ${a} log_test_addr ${a} $? 0 "Device server, device client, local conn" log_start show_hint "Should fail 'Connection refused'" @@ -3010,12 +2850,11 @@ ipv6_udp_novrf() # LLA to GUA run_cmd_nsb ip -6 addr del ${NSB_IP6}/64 dev ${NSB_DEV} run_cmd_nsb ip -6 ro add ${NSA_IP6}/128 dev ${NSB_DEV} log_start - run_cmd nettest -6 -s -D & - sleep 1 + run_cmd nettest -6 -s -D -k run_cmd_nsb nettest -6 -D -r ${NSA_IP6} log_test $? 0 "UDP in - LLA to GUA" run_cmd_nsb ip -6 ro del ${NSA_IP6}/128 dev ${NSB_DEV} run_cmd_nsb ip -6 addr add ${NSB_IP6}/64 dev ${NSB_DEV} @@ -3034,30 +2873,27 @@ ipv6_udp_vrf() # for a in ${NSA_IP6} ${VRF_IP6} do log_start show_hint "Should fail 'Connection refused' since global server is disabled" - run_cmd nettest -6 -D -s & - sleep 1 + run_cmd nettest -6 -D -s -k run_cmd_nsb nettest -6 -D -r ${a} log_test_addr ${a} $? 1 "Global server" done for a in ${NSA_IP6} ${VRF_IP6} do log_start - run_cmd nettest -6 -D -I ${VRF} -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -D -I ${VRF} -s -3 ${NSA_DEV} -k run_cmd_nsb nettest -6 -D -r ${a} log_test_addr ${a} $? 0 "VRF server" done for a in ${NSA_IP6} ${VRF_IP6} do log_start - run_cmd nettest -6 -D -I ${NSA_DEV} -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -D -I ${NSA_DEV} -s -3 ${NSA_DEV} -k run_cmd_nsb nettest -6 -D -r ${a} log_test_addr ${a} $? 0 "Enslaved device server" done # negative test - should fail @@ -3074,48 +2910,42 @@ ipv6_udp_vrf() # for a in ${NSA_IP6} ${VRF_IP6} do log_start show_hint "Should fail 'Connection refused' since global server is disabled" - run_cmd nettest -6 -D -s & - sleep 1 + run_cmd nettest -6 -D -s -k run_cmd nettest -6 -D -d ${VRF} -r ${a} log_test_addr ${a} $? 1 "Global server, VRF client, local conn" done for a in ${NSA_IP6} ${VRF_IP6} do log_start - run_cmd nettest -6 -D -I ${VRF} -s & - sleep 1 + run_cmd nettest -6 -D -I ${VRF} -s -k run_cmd nettest -6 -D -d ${VRF} -r ${a} log_test_addr ${a} $? 0 "VRF server, VRF client, local conn" done a=${NSA_IP6} log_start show_hint "Should fail 'Connection refused' since global server is disabled" - run_cmd nettest -6 -D -s & - sleep 1 + run_cmd nettest -6 -D -s -k run_cmd nettest -6 -D -d ${NSA_DEV} -r ${a} log_test_addr ${a} $? 1 "Global server, device client, local conn" log_start - run_cmd nettest -6 -D -I ${VRF} -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -D -I ${VRF} -s -3 ${NSA_DEV} -k run_cmd nettest -6 -D -d ${NSA_DEV} -r ${a} log_test_addr ${a} $? 0 "VRF server, device client, local conn" log_start - run_cmd nettest -6 -D -I ${NSA_DEV} -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -D -I ${NSA_DEV} -s -3 ${NSA_DEV} -k run_cmd nettest -6 -D -d ${VRF} -r ${a} log_test_addr ${a} $? 0 "Enslaved device server, VRF client, local conn" log_start - run_cmd nettest -6 -D -I ${NSA_DEV} -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -D -I ${NSA_DEV} -s -3 ${NSA_DEV} -k run_cmd nettest -6 -D -d ${NSA_DEV} -r ${a} log_test_addr ${a} $? 0 "Enslaved device server, device client, local conn" # disable global server log_subsection "Global server enabled" @@ -3125,30 +2955,27 @@ ipv6_udp_vrf() # server tests # for a in ${NSA_IP6} ${VRF_IP6} do log_start - run_cmd nettest -6 -D -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -D -s -3 ${NSA_DEV} -k run_cmd_nsb nettest -6 -D -r ${a} log_test_addr ${a} $? 0 "Global server" done for a in ${NSA_IP6} ${VRF_IP6} do log_start - run_cmd nettest -6 -D -I ${VRF} -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -D -I ${VRF} -s -3 ${NSA_DEV} -k run_cmd_nsb nettest -6 -D -r ${a} log_test_addr ${a} $? 0 "VRF server" done for a in ${NSA_IP6} ${VRF_IP6} do log_start - run_cmd nettest -6 -D -I ${NSA_DEV} -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -D -I ${NSA_DEV} -s -3 ${NSA_DEV} -k run_cmd_nsb nettest -6 -D -r ${a} log_test_addr ${a} $? 0 "Enslaved device server" done # negative test - should fail @@ -3161,23 +2988,21 @@ ipv6_udp_vrf() # # client tests # log_start - run_cmd_nsb nettest -6 -D -s & - sleep 1 + run_cmd_nsb nettest -6 -D -s -k run_cmd nettest -6 -D -d ${VRF} -r ${NSB_IP6} log_test $? 0 "VRF client" # negative test - should fail log_start run_cmd nettest -6 -D -d ${VRF} -r ${NSB_IP6} log_test $? 1 "No server, VRF client" log_start - run_cmd_nsb nettest -6 -D -s & - sleep 1 + run_cmd_nsb nettest -6 -D -s -k run_cmd nettest -6 -D -d ${NSA_DEV} -r ${NSB_IP6} log_test $? 0 "Enslaved device client" # negative test - should fail log_start @@ -3187,32 +3012,28 @@ ipv6_udp_vrf() # # local address tests # a=${NSA_IP6} log_start - run_cmd nettest -6 -D -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -D -s -3 ${NSA_DEV} -k run_cmd nettest -6 -D -d ${VRF} -r ${a} log_test_addr ${a} $? 0 "Global server, VRF client, local conn" #log_start - run_cmd nettest -6 -D -I ${VRF} -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -D -I ${VRF} -s -3 ${NSA_DEV} -k run_cmd nettest -6 -D -d ${VRF} -r ${a} log_test_addr ${a} $? 0 "VRF server, VRF client, local conn" a=${VRF_IP6} log_start - run_cmd nettest -6 -D -s -3 ${VRF} & - sleep 1 + run_cmd nettest -6 -D -s -3 ${VRF} -k run_cmd nettest -6 -D -d ${VRF} -r ${a} log_test_addr ${a} $? 0 "Global server, VRF client, local conn" log_start - run_cmd nettest -6 -D -I ${VRF} -s -3 ${VRF} & - sleep 1 + run_cmd nettest -6 -D -I ${VRF} -s -3 ${VRF} -k run_cmd nettest -6 -D -d ${VRF} -r ${a} log_test_addr ${a} $? 0 "VRF server, VRF client, local conn" # negative test - should fail for a in ${NSA_IP6} ${VRF_IP6} @@ -3223,64 +3044,57 @@ ipv6_udp_vrf() done # device to global IP a=${NSA_IP6} log_start - run_cmd nettest -6 -D -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -D -s -3 ${NSA_DEV} -k run_cmd nettest -6 -D -d ${NSA_DEV} -r ${a} log_test_addr ${a} $? 0 "Global server, device client, local conn" log_start - run_cmd nettest -6 -D -I ${VRF} -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -D -I ${VRF} -s -3 ${NSA_DEV} -k run_cmd nettest -6 -D -d ${NSA_DEV} -r ${a} log_test_addr ${a} $? 0 "VRF server, device client, local conn" log_start - run_cmd nettest -6 -D -I ${NSA_DEV} -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -D -I ${NSA_DEV} -s -3 ${NSA_DEV} -k run_cmd nettest -6 -D -d ${VRF} -r ${a} log_test_addr ${a} $? 0 "Device server, VRF client, local conn" log_start - run_cmd nettest -6 -D -I ${NSA_DEV} -s -3 ${NSA_DEV} & - sleep 1 + run_cmd nettest -6 -D -I ${NSA_DEV} -s -3 ${NSA_DEV} -k run_cmd nettest -6 -D -d ${NSA_DEV} -r ${a} log_test_addr ${a} $? 0 "Device server, device client, local conn" log_start run_cmd nettest -6 -D -d ${NSA_DEV} -r ${a} log_test_addr ${a} $? 1 "No server, device client, local conn" # link local addresses log_start - run_cmd nettest -6 -D -s & - sleep 1 + run_cmd nettest -6 -D -s -k run_cmd_nsb nettest -6 -D -d ${NSB_DEV} -r ${NSA_LINKIP6} log_test $? 0 "Global server, linklocal IP" log_start run_cmd_nsb nettest -6 -D -d ${NSB_DEV} -r ${NSA_LINKIP6} log_test $? 1 "No server, linklocal IP" log_start - run_cmd_nsb nettest -6 -D -s & - sleep 1 + run_cmd_nsb nettest -6 -D -s -k run_cmd nettest -6 -D -d ${NSA_DEV} -r ${NSB_LINKIP6} log_test $? 0 "Enslaved device client, linklocal IP" log_start run_cmd nettest -6 -D -d ${NSA_DEV} -r ${NSB_LINKIP6} log_test $? 1 "No server, device client, peer linklocal IP" log_start - run_cmd nettest -6 -D -s & - sleep 1 + run_cmd nettest -6 -D -s -k run_cmd nettest -6 -D -d ${NSA_DEV} -r ${NSA_LINKIP6} log_test $? 0 "Enslaved device client, local conn - linklocal IP" log_start run_cmd nettest -6 -D -d ${NSA_DEV} -r ${NSA_LINKIP6} @@ -3288,12 +3102,11 @@ ipv6_udp_vrf() # LLA to GUA run_cmd_nsb ip -6 addr del ${NSB_IP6}/64 dev ${NSB_DEV} run_cmd_nsb ip -6 ro add ${NSA_IP6}/128 dev ${NSB_DEV} log_start - run_cmd nettest -6 -s -D & - sleep 1 + run_cmd nettest -6 -s -D -k run_cmd_nsb nettest -6 -D -r ${NSA_IP6} log_test $? 0 "UDP in - LLA to GUA" run_cmd_nsb ip -6 ro del ${NSA_IP6}/128 dev ${NSB_DEV} run_cmd_nsb ip -6 addr add ${NSB_IP6}/64 dev ${NSB_DEV} @@ -3443,12 +3256,11 @@ ipv6_rt() # server tests # for a in ${NSA_IP6} ${VRF_IP6} do log_start - run_cmd nettest ${varg} -s & - sleep 1 + run_cmd nettest ${varg} -s -k run_cmd_nsb nettest ${varg} -r ${a} & sleep 3 run_cmd ip link del ${VRF} sleep 1 log_test_addr ${a} 0 0 "${desc}, global server" @@ -3457,12 +3269,11 @@ ipv6_rt() done for a in ${NSA_IP6} ${VRF_IP6} do log_start - run_cmd nettest ${varg} -I ${VRF} -s & - sleep 1 + run_cmd nettest ${varg} -I ${VRF} -s -k run_cmd_nsb nettest ${varg} -r ${a} & sleep 3 run_cmd ip link del ${VRF} sleep 1 log_test_addr ${a} 0 0 "${desc}, VRF server" @@ -3471,12 +3282,11 @@ ipv6_rt() done for a in ${NSA_IP6} ${VRF_IP6} do log_start - run_cmd nettest ${varg} -I ${NSA_DEV} -s & - sleep 1 + run_cmd nettest ${varg} -I ${NSA_DEV} -s -k run_cmd_nsb nettest ${varg} -r ${a} & sleep 3 run_cmd ip link del ${VRF} sleep 1 log_test_addr ${a} 0 0 "${desc}, enslaved device server" @@ -3486,23 +3296,21 @@ ipv6_rt() # # client test # log_start - run_cmd_nsb nettest ${varg} -s & - sleep 1 + run_cmd_nsb nettest ${varg} -s -k run_cmd nettest ${varg} -d ${VRF} -r ${NSB_IP6} & sleep 3 run_cmd ip link del ${VRF} sleep 1 log_test 0 0 "${desc}, VRF client" setup ${with_vrf} log_start - run_cmd_nsb nettest ${varg} -s & - sleep 1 + run_cmd_nsb nettest ${varg} -s -k run_cmd nettest ${varg} -d ${NSA_DEV} -r ${NSB_IP6} & sleep 3 run_cmd ip link del ${VRF} sleep 1 log_test 0 0 "${desc}, enslaved device client" @@ -3514,12 +3322,11 @@ ipv6_rt() # local address tests # for a in ${NSA_IP6} ${VRF_IP6} do log_start - run_cmd nettest ${varg} -s & - sleep 1 + run_cmd nettest ${varg} -s -k run_cmd nettest ${varg} -d ${VRF} -r ${a} & sleep 3 run_cmd ip link del ${VRF} sleep 1 log_test_addr ${a} 0 0 "${desc}, global server, VRF client" @@ -3528,12 +3335,11 @@ ipv6_rt() done for a in ${NSA_IP6} ${VRF_IP6} do log_start - run_cmd nettest ${varg} -I ${VRF} -s & - sleep 1 + run_cmd nettest ${varg} -I ${VRF} -s -k run_cmd nettest ${varg} -d ${VRF} -r ${a} & sleep 3 run_cmd ip link del ${VRF} sleep 1 log_test_addr ${a} 0 0 "${desc}, VRF server and client" @@ -3541,34 +3347,31 @@ ipv6_rt() setup ${with_vrf} done a=${NSA_IP6} log_start - run_cmd nettest ${varg} -s & - sleep 1 + run_cmd nettest ${varg} -s -k run_cmd nettest ${varg} -d ${NSA_DEV} -r ${a} & sleep 3 run_cmd ip link del ${VRF} sleep 1 log_test_addr ${a} 0 0 "${desc}, global server, device client" setup ${with_vrf} log_start - run_cmd nettest ${varg} -I ${VRF} -s & - sleep 1 + run_cmd nettest ${varg} -I ${VRF} -s -k run_cmd nettest ${varg} -d ${NSA_DEV} -r ${a} & sleep 3 run_cmd ip link del ${VRF} sleep 1 log_test_addr ${a} 0 0 "${desc}, VRF server, device client" setup ${with_vrf} log_start - run_cmd nettest ${varg} -I ${NSA_DEV} -s & - sleep 1 + run_cmd nettest ${varg} -I ${NSA_DEV} -s -k run_cmd nettest ${varg} -d ${NSA_DEV} -r ${a} & sleep 3 run_cmd ip link del ${VRF} sleep 1 log_test_addr ${a} 0 0 "${desc}, device server, device client" @@ -3622,12 +3425,11 @@ netfilter_tcp_reset() local a for a in ${NSA_IP} ${VRF_IP} do log_start - run_cmd nettest -s & - sleep 1 + run_cmd nettest -s -k run_cmd_nsb nettest -r ${a} log_test_addr ${a} $? 1 "Global server, reject with TCP-reset on Rx" done } @@ -3640,12 +3442,11 @@ netfilter_icmp() [ "${stype}" = "UDP" ] && arg="-D" for a in ${NSA_IP} ${VRF_IP} do log_start - run_cmd nettest ${arg} -s & - sleep 1 + run_cmd nettest ${arg} -s -k run_cmd_nsb nettest ${arg} -r ${a} log_test_addr ${a} $? 1 "Global ${stype} server, Rx reject icmp-port-unreach" done } @@ -3679,12 +3480,11 @@ netfilter_tcp6_reset() local a for a in ${NSA_IP6} ${VRF_IP6} do log_start - run_cmd nettest -6 -s & - sleep 1 + run_cmd nettest -6 -s -k run_cmd_nsb nettest -6 -r ${a} log_test_addr ${a} $? 1 "Global server, reject with TCP-reset on Rx" done } @@ -3697,12 +3497,11 @@ netfilter_icmp6() [ "${stype}" = "UDP" ] && arg="$arg -D" for a in ${NSA_IP6} ${VRF_IP6} do log_start - run_cmd nettest -6 -s ${arg} & - sleep 1 + run_cmd nettest -6 -s ${arg} -k run_cmd_nsb nettest -6 ${arg} -r ${a} log_test_addr ${a} $? 1 "Global ${stype} server, Rx reject icmp-port-unreach" done } @@ -3893,17 +3692,15 @@ use_case_snat_on_vrf() local port="12345" run_cmd iptables -t nat -A POSTROUTING -p tcp -m tcp --dport ${port} -j SNAT --to-source ${NSA_LO_IP} -o ${VRF} run_cmd ip6tables -t nat -A POSTROUTING -p tcp -m tcp --dport ${port} -j SNAT --to-source ${NSA_LO_IP6} -o ${VRF} - run_cmd_nsb nettest -s -l ${NSB_IP} -p ${port} & - sleep 1 + run_cmd_nsb nettest -s -l ${NSB_IP} -p ${port} -k run_cmd nettest -d ${VRF} -r ${NSB_IP} -p ${port} log_test $? 0 "IPv4 TCP connection over VRF with SNAT" - run_cmd_nsb nettest -6 -s -l ${NSB_IP6} -p ${port} & - sleep 1 + run_cmd_nsb nettest -6 -s -l ${NSB_IP6} -p ${port} -k run_cmd nettest -6 -d ${VRF} -r ${NSB_IP6} -p ${port} log_test $? 0 "IPv6 TCP connection over VRF with SNAT" # Cleanup run_cmd iptables -t nat -D POSTROUTING -p tcp -m tcp --dport ${port} -j SNAT --to-source ${NSA_LO_IP} -o ${VRF} From patchwork Wed Oct 6 11:47:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 12539323 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB67BC433F5 for ; Wed, 6 Oct 2021 11:48:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B87846117A for ; Wed, 6 Oct 2021 11:48:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238593AbhJFLu0 (ORCPT ); Wed, 6 Oct 2021 07:50:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238615AbhJFLuG (ORCPT ); Wed, 6 Oct 2021 07:50:06 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6ACA4C061772; Wed, 6 Oct 2021 04:48:04 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id d8so8764773edx.9; Wed, 06 Oct 2021 04:48:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UzgnEBfEy8GITMpLw3dCBMiAJFduwV8u4GzYFR+Amz8=; b=VNzQpuNASk12h/qIDrkjwE5DLpVV0k5g33AmttoauD5vw+Mt4OIFhYDmHu5H7sWwcF c2fQPrELKOu37tgzts7WWa7H+YqzzRhxTBwHxyk/YE7e5o2gTz8DUuBVUxs2A/xIqbUL N6D773eX0BCz/NzvdC30G3QH4nDyDgUcIrXn1Ye9aP5BkhEIcNZlyAiyUuvVV1T0lYty nLdgSyxrM8tbQ0zRC4hhU6iNdWCe1Bgk0HoOcV4bSc2Gx6wzlUArDPs30FGZdUrl2g3r zsbvJzXWa3Ms+Rep39gajupjCvC4+5HU9J+ACKzY2VudfW8lUDxO5jLvKPMK66nwl3f8 GtlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UzgnEBfEy8GITMpLw3dCBMiAJFduwV8u4GzYFR+Amz8=; b=HvlTj+xnn6Z1xFmz0mQgx/ZA16W0FmBDwiMNHR05rE3FuHMeppSN+KQU5pbd2PZwV2 ywdCtEqDohVn43s7Zq1Y/CqnJEAA/SQko2l0r1cH5OUI+IJ/ZwM/QZdBpLxQM8bd56/9 9v1rE5noGrgI1k67CA0/abBKnZmr7T2LkocUfNPujBNgtpwkEdqLsfsJ8HoMabLzMwxX bSR2NcWeDPmheIREn5zkJr/2r9FhZTuWH/ay46gq0UNUij9Vzr/fMUzfMhW2rmFVmXo3 5DmgPugSgWY+Qt9o2dvuq1oLaeTy9u6a1dNc3ztpijtKo8nFn3tlCxzBIdPIscP1Lmn0 TdNQ== X-Gm-Message-State: AOAM5338u0EyJI7E7k6slzm8KSNeFUouDEJOIp0mLHl6YrVJZZ285JfZ dMyIshWUwWLjrbvmGV+2fws= X-Google-Smtp-Source: ABdhPJwMD6nSBGOh5piuQ9ajkXRfLh7Bf8LPnoeIY5d5PVXj4ZL1Z+U+yLMao/gHVvorYbF8yOTlNQ== X-Received: by 2002:a17:906:3281:: with SMTP id 1mr31239704ejw.167.1633520882849; Wed, 06 Oct 2021 04:48:02 -0700 (PDT) Received: from localhost.localdomain ([95.76.3.69]) by smtp.gmail.com with ESMTPSA id y40sm1402187ede.31.2021.10.06.04.48.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 04:48:02 -0700 (PDT) From: Leonard Crestez To: Jakub Kicinski , Shuah Khan , David Ahern Cc: "David S. Miller" , Ido Schimmel , Seth David Schoen , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/11] selftests: nettest: Convert timeout to miliseconds Date: Wed, 6 Oct 2021 14:47:25 +0300 Message-Id: <5a320aefed743c2a0e64c3cb30b3e258db013d1b.1633520807.git.cdleonard@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org This allows tests to be faster Signed-off-by: Leonard Crestez Reviewed-by: David Ahern --- tools/testing/selftests/net/nettest.c | 52 +++++++++++++++++++++------ 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/tools/testing/selftests/net/nettest.c b/tools/testing/selftests/net/nettest.c index 576d8bb4c94c..eb6c8cf69a74 100644 --- a/tools/testing/selftests/net/nettest.c +++ b/tools/testing/selftests/net/nettest.c @@ -125,18 +125,24 @@ struct sock_args { /* ESP in UDP encap test */ int use_xfrm; }; static int server_mode; -static unsigned int prog_timeout = 5; +static unsigned int prog_timeout_ms = 5000; static unsigned int interactive; static int iter = 1; static char *msg = "Hello world!"; static int msglen; static int quiet; static int try_broadcast = 1; +static void set_timeval_ms(struct timeval *tv, unsigned long ms) +{ + tv->tv_sec = ms / 1000; + tv->tv_usec = (ms % 1000) * 1000; +} + static char *timestamp(char *timebuf, int buflen) { time_t now; now = time(NULL); @@ -566,10 +572,29 @@ static int str_to_uint(const char *str, int min, int max, unsigned int *value) } return -1; } +/* parse seconds with a decimal point as miliseconds */ +static int str_to_msec(const char *str, unsigned int *value) +{ + float float_value; + char *end; + + float_value = strtof(str, &end); + + /* entire string should be consumed by conversion + * and value should be between min and max + */ + if (((*end == '\0') || (*end == '\n')) && (end != str)) { + *value = float_value * 1000; + return 0; + } + + return -1; +} + static int resolve_devices(struct sock_args *args) { if (args->dev) { args->ifindex = get_ifidx(args->dev); if (args->ifindex < 0) { @@ -1165,11 +1190,11 @@ static void set_recv_attr(int sd, int version) } static int msg_loop(int client, int sd, void *addr, socklen_t alen, struct sock_args *args) { - struct timeval timeout = { .tv_sec = prog_timeout }, *ptval = NULL; + struct timeval timeout, *ptval = NULL; fd_set rfds; int nfds; int rc; if (args->type != SOCK_STREAM) @@ -1182,13 +1207,15 @@ static int msg_loop(int client, int sd, void *addr, socklen_t alen, if (client) { if (send_msg(sd, addr, alen, args)) return 1; } if (!interactive) { + if (!prog_timeout_ms) + set_timeval_ms(&timeout, 5000); + else + set_timeval_ms(&timeout, prog_timeout_ms); ptval = &timeout; - if (!prog_timeout) - timeout.tv_sec = 5; } } nfds = interactive ? MAX(fileno(stdin), sd) + 1 : sd + 1; while (1) { @@ -1479,11 +1506,11 @@ static void ipc_write(int fd, int message) } static int do_server(struct sock_args *args, int ipc_fd) { /* ipc_fd = -1 if no parent process to signal */ - struct timeval timeout = { .tv_sec = prog_timeout }, *ptval = NULL; + struct timeval timeout, *ptval = NULL; unsigned char addr[sizeof(struct sockaddr_in6)] = {}; socklen_t alen = sizeof(addr); int lsd, csd = -1; fd_set rfds; @@ -1501,12 +1528,14 @@ static int do_server(struct sock_args *args, int ipc_fd) args->dev = args->server_dev; args->expected_dev = args->expected_server_dev; if (resolve_devices(args) || validate_addresses(args)) goto err_exit; - if (prog_timeout) + if (prog_timeout_ms) { + set_timeval_ms(&timeout, prog_timeout_ms); ptval = &timeout; + } if (args->has_grp) lsd = msock_server(args); else lsd = lsock_init(args); @@ -1584,20 +1613,22 @@ static int do_server(struct sock_args *args, int ipc_fd) return 1; } static int wait_for_connect(int sd) { - struct timeval _tv = { .tv_sec = prog_timeout }, *tv = NULL; + struct timeval _tv, *tv = NULL; fd_set wfd; int val = 0, sz = sizeof(val); int rc; FD_ZERO(&wfd); FD_SET(sd, &wfd); - if (prog_timeout) + if (prog_timeout_ms) { + set_timeval_ms(&_tv, prog_timeout_ms); tv = &_tv; + } rc = select(FD_SETSIZE, NULL, &wfd, NULL, tv); if (rc == 0) { log_error("connect timed out\n"); return -2; @@ -1945,12 +1976,11 @@ int main(int argc, char *argv[]) return 1; } args.port = (unsigned short) tmp; break; case 't': - if (str_to_uint(optarg, 0, INT_MAX, - &prog_timeout) != 0) { + if (str_to_msec(optarg, &prog_timeout_ms) != 0) { fprintf(stderr, "Invalid timeout\n"); return 1; } break; case 'D': @@ -2091,11 +2121,11 @@ int main(int argc, char *argv[]) "Fork after listen only supported for server mode\n"); return 1; } if (interactive) { - prog_timeout = 0; + prog_timeout_ms = 0; msg = NULL; } if (both_mode) { if (pipe(fd) < 0) { From patchwork Wed Oct 6 11:47:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 12539325 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF2EAC433FE for ; Wed, 6 Oct 2021 11:48:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 971BA6113E for ; Wed, 6 Oct 2021 11:48:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238652AbhJFLu3 (ORCPT ); Wed, 6 Oct 2021 07:50:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238660AbhJFLuK (ORCPT ); Wed, 6 Oct 2021 07:50:10 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B29BC061778; Wed, 6 Oct 2021 04:48:06 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id v18so8713807edc.11; Wed, 06 Oct 2021 04:48:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qOGjkZMl8DerBlT4kJpDzU8Uye/g7CHr0erytT4iSf4=; b=hSsgAUhJwv+j3HxImHE/DQRFOci0Fj1ma/4HX1Zi5G9Vx3RNUz6YqdspTfuuh2iGU0 ooFtF8n3c0Kl5/k+08GhNaGpMVqFjVf4RLHi0CWuP2JIQl64JedQqWLnlwHt5d1yr8AF TJQCPPw6oYfn4FAnFoC2gt0oV1BirEH87zROVD+jUG/RWClU2mPS+KzoFKTd1Y3B//HO 3SRgCFhL0kK9hjbnFRRUgHoows9CToXlYr5VbmJdg2c/z5/B7pCLHkEDw3+VgFYcS8P5 D2wi19NSyoAifch+flAFdtIa07Y5tXwFz1h36dnKp1g1OriSD1Z+LtNHCgRtrxubk6Gh azFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qOGjkZMl8DerBlT4kJpDzU8Uye/g7CHr0erytT4iSf4=; b=oTTxjN4Nuq/krJB0uyiNKjX9Aaa6FqLfxXGM/trAQ/p0rZRviVYyye8w1TNRYwAGHH gDJyT1IL7LBQ4gPUdB7ilwnwNuplnZoEQ7WK3eACbquv/JVNvplMTKjWoSeAXdneBp3N u32yk7LSfHKLed+IGCMRiNxST6x3N3PW+tZueu+PO+Hma7fo2LdfeoEszmvCuVV+Q6nD Ve0iEePr12j3ohH59bauvQZf+p9Y7DW6hU0TyQoP6Vmd2t5wQg85UpXJHqoS5nOt1HPZ HLlJrB+ucaMFr6cPm5u0paeXnPqOl7VCg7id1mnXSUYlq28JXiKts4qbN5yrwfX4eWJE OkVw== X-Gm-Message-State: AOAM531PU+T4JjVMKTD7oPijnixOB83H9cqWKn35JzaNfbdSUojFrCdT Y83BP9k+FBtXGUcBY2Lw81w= X-Google-Smtp-Source: ABdhPJzJGNtNmryU+B+aCYTq/ZRvoO2qnWejJi7zLZQV+rb93P6zFXpxo/0kIl+HTwiihXs90/fQVg== X-Received: by 2002:a17:906:7f01:: with SMTP id d1mr32126761ejr.318.1633520884077; Wed, 06 Oct 2021 04:48:04 -0700 (PDT) Received: from localhost.localdomain ([95.76.3.69]) by smtp.gmail.com with ESMTPSA id y40sm1402187ede.31.2021.10.06.04.48.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 04:48:03 -0700 (PDT) From: Leonard Crestez To: Jakub Kicinski , Shuah Khan , David Ahern Cc: "David S. Miller" , Ido Schimmel , Seth David Schoen , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/11] selftests: nettest: Add NETTEST_CLIENT,SERVER}_TIMEOUT envvars Date: Wed, 6 Oct 2021 14:47:26 +0300 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Move the single "prog_timeout_ms" into sock_args and split into client and server timeouts. Add NETTEST_CLIENT_TIMEOUT and NETTEST_SERVER_TIMEOUT which can set a default value different than the default of 5 seconds. This allows exporting NETTEST_CLIENT_TIMEOUT=0.1 and running all of fcnal-test.sh quickly. A reduced server timeout is less useful, most tests would work fine with an infinite timeout because nettest is launched in the background and killed explicitly. Signed-off-by: Leonard Crestez --- tools/testing/selftests/net/nettest.c | 66 ++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/net/nettest.c b/tools/testing/selftests/net/nettest.c index eb6c8cf69a74..bc5976f842f9 100644 --- a/tools/testing/selftests/net/nettest.c +++ b/tools/testing/selftests/net/nettest.c @@ -122,14 +122,16 @@ struct sock_args { struct in6_addr in6; } expected_raddr; /* ESP in UDP encap test */ int use_xfrm; + + unsigned int client_timeout_ms; + unsigned int server_timeout_ms; }; static int server_mode; -static unsigned int prog_timeout_ms = 5000; static unsigned int interactive; static int iter = 1; static char *msg = "Hello world!"; static int msglen; static int quiet; @@ -1207,14 +1209,21 @@ static int msg_loop(int client, int sd, void *addr, socklen_t alen, if (client) { if (send_msg(sd, addr, alen, args)) return 1; } if (!interactive) { - if (!prog_timeout_ms) + unsigned int timeout_ms; + + if (client) + timeout_ms = args->client_timeout_ms; + else + timeout_ms = args->server_timeout_ms; + + if (!timeout_ms) set_timeval_ms(&timeout, 5000); else - set_timeval_ms(&timeout, prog_timeout_ms); + set_timeval_ms(&timeout, timeout_ms); ptval = &timeout; } } nfds = interactive ? MAX(fileno(stdin), sd) + 1 : sd + 1; @@ -1528,12 +1537,12 @@ static int do_server(struct sock_args *args, int ipc_fd) args->dev = args->server_dev; args->expected_dev = args->expected_server_dev; if (resolve_devices(args) || validate_addresses(args)) goto err_exit; - if (prog_timeout_ms) { - set_timeval_ms(&timeout, prog_timeout_ms); + if (args->server_timeout_ms) { + set_timeval_ms(&timeout, args->server_timeout_ms); ptval = &timeout; } if (args->has_grp) lsd = msock_server(args); @@ -1611,22 +1620,22 @@ static int do_server(struct sock_args *args, int ipc_fd) err_exit: ipc_write(ipc_fd, 0); return 1; } -static int wait_for_connect(int sd) +static int wait_for_connect(int sd, struct sock_args *args) { struct timeval _tv, *tv = NULL; fd_set wfd; int val = 0, sz = sizeof(val); int rc; FD_ZERO(&wfd); FD_SET(sd, &wfd); - if (prog_timeout_ms) { - set_timeval_ms(&_tv, prog_timeout_ms); + if (args->client_timeout_ms) { + set_timeval_ms(&_tv, args->client_timeout_ms); tv = &_tv; } rc = select(FD_SETSIZE, NULL, &wfd, NULL, tv); if (rc == 0) { @@ -1692,11 +1701,11 @@ static int connectsock(void *addr, socklen_t alen, struct sock_args *args) if (errno != EINPROGRESS) { log_err_errno("Failed to connect to remote host"); rc = -1; goto err; } - rc = wait_for_connect(sd); + rc = wait_for_connect(sd, args); if (rc < 0) goto err; } out: return sd; @@ -1883,11 +1892,11 @@ static void print_usage(char *prog) "Required:\n" " -r addr remote address to connect to (client mode only)\n" " -p port port to connect to (client mode)/listen on (server mode)\n" " (default: %d)\n" " -s server mode (default: client mode)\n" - " -t timeout seconds (default: none)\n" + " -t seconds timeout seconds for both client and server (default: 5.000)\n" "\n" "Optional:\n" " -B do both client and server via fork and IPC\n" " -N ns set client to network namespace ns (requires root)\n" " -O ns set server to network namespace ns (requires root)\n" @@ -1920,19 +1929,46 @@ static void print_usage(char *prog) " -3 dev Expected device name (or index) to receive packets - server mode\n" "\n" " -b Bind test only.\n" " -q Be quiet. Run test without printing anything.\n" " -k Fork server in background after bind or listen.\n" + "\n" + "Environment Variables:" + "\n" + "NETTEST_CLIENT_TIMEOUT: timeouts in seconds for client" + "NETTEST_SERVER_TIMEOUT: timeouts in seconds for server" , prog, DEFAULT_PORT); } +int parse_env(struct sock_args *args) +{ + const char *str; + + if ((str = getenv("NETTEST_CLIENT_TIMEOUT"))) { + if (str_to_msec(str, &args->client_timeout_ms) != 0) { + fprintf(stderr, "Invalid NETTEST_CLIENT_TIMEOUT\n"); + return 1; + } + } + if ((str = getenv("NETTEST_SERVER_TIMEOUT"))) { + if (str_to_msec(str, &args->server_timeout_ms) != 0) { + fprintf(stderr, "Invalid NETTEST_SERVER_TIMEOUT\n"); + return 1; + } + } + + return 0; +} + int main(int argc, char *argv[]) { struct sock_args args = { .version = AF_INET, .type = SOCK_STREAM, .port = DEFAULT_PORT, + .client_timeout_ms = 5000, + .server_timeout_ms = 5000, }; struct protoent *pe; int both_mode = 0; unsigned int tmp; int forever = 0; @@ -1941,10 +1977,14 @@ int main(int argc, char *argv[]) /* process inputs */ extern char *optarg; int rc = 0; + rc = parse_env(&args); + if (rc) + return rc; + /* * process input args */ while ((rc = getopt(argc, argv, GETOPT_STR)) != -1) { @@ -1976,14 +2016,15 @@ int main(int argc, char *argv[]) return 1; } args.port = (unsigned short) tmp; break; case 't': - if (str_to_msec(optarg, &prog_timeout_ms) != 0) { + if (str_to_msec(optarg, &args.client_timeout_ms) != 0) { fprintf(stderr, "Invalid timeout\n"); return 1; } + args.server_timeout_ms = args.client_timeout_ms; break; case 'D': args.type = SOCK_DGRAM; break; case 'R': @@ -2121,11 +2162,12 @@ int main(int argc, char *argv[]) "Fork after listen only supported for server mode\n"); return 1; } if (interactive) { - prog_timeout_ms = 0; + args.client_timeout_ms = 0; + args.server_timeout_ms = 0; msg = NULL; } if (both_mode) { if (pipe(fd) < 0) { From patchwork Wed Oct 6 11:47:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 12539327 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33AE5C433EF for ; Wed, 6 Oct 2021 11:48:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1B34261131 for ; Wed, 6 Oct 2021 11:48:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238631AbhJFLub (ORCPT ); Wed, 6 Oct 2021 07:50:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238666AbhJFLuN (ORCPT ); Wed, 6 Oct 2021 07:50:13 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E58BC0613EC; Wed, 6 Oct 2021 04:48:08 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id v18so8714078edc.11; Wed, 06 Oct 2021 04:48:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MPgQCPkYaOpHja7N0AhXNyX4WW/+9TkQblRPZxpVE+k=; b=JubygY18ja+WTyxK/Qi/6q9linLjbd9murzVIylYEOxlbXvystozejq4NTkBBM2E2v BMwy9oVkPhXVNMaqM1QG/p9CVRjE1t/I5isyLv2CYzxd3c6WE8p5gT9wTd4aEU9QEqap sW2lbQ0L4tzqGaZitdlOYznPtxjbipIX9cZfm40VmkrfxTq+ubvFy458UxreVMg6lW0w K++zoGFb4LexRTiNQPa34XQXtdFgnSwg4rM0N6np5ASb41w6IWdlwvuioaJAePT+Gsis dvd73znCNjxwJcbbkAnH/a8FZjhVrfKsz7VwpPHUNYl4uYGWvz/LsNEnmpIb6fnkWLGo GtiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MPgQCPkYaOpHja7N0AhXNyX4WW/+9TkQblRPZxpVE+k=; b=noVaYCmpXgHPt97ey3iCK71mLkGmnxMRg/zpXisy6UcDtbMB8q1gZ/Z7LiPIFrGHXK D3zJWu3fjaNqxu9Tv39Kz2qFlv8K3fnS/K5KXj0/kAeTJ25JekVvpMUnNr79K0/E4WcO p4t/+HtY2H1+wnQJYmhjEca5kfSkL/DeEFL3Fqz+6J44kXEdeG+30VcfqkHJxr3cCE2o E+jVHbCjtIA3kzYE9f0G3X0m2KciSwiVL39T5cNd9ckYdQzhFxOrDVjw+RHBk0UalMAJ gaGOfL+3EV8UXU06eSPifT6DDPUwHkjV9bLCcKUSCaSaUwu1Df27rWI9khB4ni2EJX0Y HWCg== X-Gm-Message-State: AOAM533wkJ6T6MbqeSq9ABinX9TP8seIyWl5n64jJ+Hsnuu/XU37Ex/m fyxfqQ+sRf2xFapWFE/M1qA= X-Google-Smtp-Source: ABdhPJzcXNMGEkbglUaY0+ODWsOSt1MyLzG2w26hG7IaQVJQHB3jkf/SXKWp75mDlJ3aDjwfNd20DQ== X-Received: by 2002:a17:906:1146:: with SMTP id i6mr32022529eja.12.1633520885218; Wed, 06 Oct 2021 04:48:05 -0700 (PDT) Received: from localhost.localdomain ([95.76.3.69]) by smtp.gmail.com with ESMTPSA id y40sm1402187ede.31.2021.10.06.04.48.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 04:48:04 -0700 (PDT) From: Leonard Crestez To: Jakub Kicinski , Shuah Khan , David Ahern Cc: "David S. Miller" , Ido Schimmel , Seth David Schoen , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 11/11] selftests: net/fcnal: Reduce client timeout Date: Wed, 6 Oct 2021 14:47:27 +0300 Message-Id: <516043441bd13bc1e6ba7f507a04362e04c06da5.1633520807.git.cdleonard@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Reduce default client timeout from 5 seconds to 500 miliseconds. Can be overridden from environment by exporting NETTEST_CLIENT_TIMEOUT=5 Some tests need ICMP timeouts so pass an explicit -t5 for those. Signed-off-by: Leonard Crestez --- tools/testing/selftests/net/fcnal-test.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh index e73aeb3884c5..cf5dd96bb9db 100755 --- a/tools/testing/selftests/net/fcnal-test.sh +++ b/tools/testing/selftests/net/fcnal-test.sh @@ -40,10 +40,15 @@ # Kselftest framework requirement - SKIP code is 4. ksft_skip=4 VERBOSE=0 +# Use a reduced client timeout by default +# Can be overridden by user +NETTEST_CLIENT_TIMEOUT=${NETTEST_CLIENT_TIMEOUT:-0.5} +export NETTEST_CLIENT_TIMEOUT + NSA_DEV=eth1 NSA_DEV2=eth2 NSB_DEV=eth1 NSC_DEV=eth2 VRF=red @@ -1076,11 +1081,11 @@ ipv4_tcp_novrf() for a in ${NSA_LO_IP} 127.0.0.1 do log_start show_hint "Should fail 'No route to host' since addresses on loopback are out of device scope" run_cmd nettest -s -k - run_cmd nettest -r ${a} -d ${NSA_DEV} + run_cmd nettest -r ${a} -d ${NSA_DEV} -t5 log_test_addr ${a} $? 1 "Global server, device client, local connection" done a=${NSA_IP} log_start @@ -1379,23 +1384,23 @@ ipv4_udp_novrf() for a in ${NSA_LO_IP} 127.0.0.1 do log_start show_hint "Should fail since addresses on loopback are out of device scope" run_cmd nettest -D -s -k - run_cmd nettest -D -r ${a} -d ${NSA_DEV} + run_cmd nettest -D -r ${a} -d ${NSA_DEV} -t5 log_test_addr ${a} $? 2 "Global server, device client, local connection" log_start show_hint "Should fail since addresses on loopback are out of device scope" run_cmd nettest -D -s -k - run_cmd nettest -D -r ${a} -d ${NSA_DEV} -C + run_cmd nettest -D -r ${a} -d ${NSA_DEV} -C -t5 log_test_addr ${a} $? 1 "Global server, device send via cmsg, local connection" log_start show_hint "Should fail since addresses on loopback are out of device scope" run_cmd nettest -D -s -k - run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S + run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S -t5 log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection" done a=${NSA_IP} log_start @@ -3443,11 +3448,11 @@ netfilter_icmp() for a in ${NSA_IP} ${VRF_IP} do log_start run_cmd nettest ${arg} -s -k - run_cmd_nsb nettest ${arg} -r ${a} + run_cmd_nsb nettest ${arg} -r ${a} -t5 log_test_addr ${a} $? 1 "Global ${stype} server, Rx reject icmp-port-unreach" done } ipv4_netfilter() @@ -3498,11 +3503,11 @@ netfilter_icmp6() for a in ${NSA_IP6} ${VRF_IP6} do log_start run_cmd nettest -6 -s ${arg} -k - run_cmd_nsb nettest -6 ${arg} -r ${a} + run_cmd_nsb nettest -6 ${arg} -r ${a} -t5 log_test_addr ${a} $? 1 "Global ${stype} server, Rx reject icmp-port-unreach" done } ipv6_netfilter()