From patchwork Thu Jan 26 21:53:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1732590 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=vgwAG+3i; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=4H3WxNaW; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P2vcQ6sR4z23hC for ; Fri, 27 Jan 2023 08:54:14 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 943993CC7AC for ; Thu, 26 Jan 2023 22:54:10 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [217.194.8.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 1112F3CC75C for ; Thu, 26 Jan 2023 22:54:07 +0100 (CET) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id 73EEB200C7F for ; Thu, 26 Jan 2023 22:54:07 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 10D9D1FECC; Thu, 26 Jan 2023 21:54:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1674770047; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8KGU/UaZmt6UCyoYV+E8AxbcoUKRsL/eClO1uo+ObT4=; b=vgwAG+3iNDHP5UeMh9gLCXktl2Svx9fV18OBgE1OLoFIRTYaPNV5CmHBgnPgdQIjQ/wXmp YLUET6LCTwIMhB32wr6ePRPjWFsm4NV8Lh7SgkvGJ6QwXVti6jGEGXWCEShH2bwUyLUZyJ +0V3ZAS3c7rmZmwd9mU8Hwz0Ye4c8HQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1674770047; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8KGU/UaZmt6UCyoYV+E8AxbcoUKRsL/eClO1uo+ObT4=; b=4H3WxNaWCDteVA1/wbq4wLIXmO/wfBZ4+ofTqKRs/HsM9QUvUBcP5ggoXNVpPgDVUub5mJ wjjGw2BXihDv9vDg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id AFDBC139B3; Thu, 26 Jan 2023 21:54:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wE7mI3720mOcYgAAMHmgww (envelope-from ); Thu, 26 Jan 2023 21:54:06 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Thu, 26 Jan 2023 22:53:53 +0100 Message-Id: <20230126215401.29101-2-pvorel@suse.cz> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230126215401.29101-1-pvorel@suse.cz> References: <20230126215401.29101-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-7.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-7.smtp.seeweb.it Subject: [LTP] [PATCH 1/9] tst_net.sh: Use tst_res_() X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" To avoid error on legacy network tests: ./tcpdump01.sh Usage: tst_res TTYPE FNAME STRING TTYPE - Test Result Type; one of TFAIL, TBROK and TCONF. FNAME - Print contents of this file after the message STRING - Message explaining the test result tcpdump01 1 TINFO: initialize 'lhost' 'ltp_ns_veth2' interface NOTE: only check in tst_net_detect_ipv6() requires to call tst_res_(), but it's better to be consistent. Fixes: ecc29beeda ("tst_net.sh: Harden library against deadlocks") Signed-off-by: Petr Vorel --- testcases/lib/tst_net.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh index e6bb09d81f..925cf50e1c 100644 --- a/testcases/lib/tst_net.sh +++ b/testcases/lib/tst_net.sh @@ -74,15 +74,15 @@ tst_net_setup() } if [ "$TST_PARSE_ARGS_CALLER" = "$TST_PARSE_ARGS" ]; then - tst_res TWARN "TST_PARSE_ARGS_CALLER same as TST_PARSE_ARGS, unset it ($TST_PARSE_ARGS)" + tst_res_ TWARN "TST_PARSE_ARGS_CALLER same as TST_PARSE_ARGS, unset it ($TST_PARSE_ARGS)" unset TST_PARSE_ARGS_CALLER fi if [ "$TST_SETUP_CALLER" = "$TST_SETUP" ]; then - tst_res TWARN "TST_SETUP_CALLER same as TST_SETUP, unset it ($TST_SETUP)" + tst_res_ TWARN "TST_SETUP_CALLER same as TST_SETUP, unset it ($TST_SETUP)" unset TST_SETUP_CALLER fi if [ "$TST_USAGE_CALLER" = "$TST_USAGE" ]; then - tst_res TWARN "TST_USAGE_CALLER same as TST_USAGE, unset it ($TST_USAGE)" + tst_res_ TWARN "TST_USAGE_CALLER same as TST_USAGE, unset it ($TST_USAGE)" unset TST_USAGE_CALLER fi @@ -117,7 +117,7 @@ tst_net_detect_ipv6() TST_NET_IPV6_ENABLED=1 else TST_NET_IPV6_ENABLED=0 - tst_res TINFO "IPv6 disabled on $type" + tst_res_ TINFO "IPv6 disabled on $type" fi } From patchwork Thu Jan 26 21:53:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1732591 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=pey9fqnz; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=XNvkIgdh; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P2vch2323z23hC for ; Fri, 27 Jan 2023 08:54:28 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id B479B3CD375 for ; Thu, 26 Jan 2023 22:54:21 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 3B2C43CC75C for ; Thu, 26 Jan 2023 22:54:08 +0100 (CET) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id A87C76005EF for ; Thu, 26 Jan 2023 22:54:07 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 621061FEFB; Thu, 26 Jan 2023 21:54:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1674770047; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GfFk3mNEH4vTFvXXhNrrkxvvmxoIzSH++jCBcySLRmQ=; b=pey9fqnztuaTLtf3KB5afCZxZSktUfvpn1ePRqF7PVa8qXNA2iP/vykVeKwCzAvMdx1WGY IXEtC7UgYtj6gWlkow2OU91vcTBccWC5Ee3f9Hvy0bsxGJl0Z1xvN2XeYFLM9ArwPcuu6+ zQ9kEqMm+ccVbQ8tn6bPQ8b+4Cc2jek= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1674770047; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GfFk3mNEH4vTFvXXhNrrkxvvmxoIzSH++jCBcySLRmQ=; b=XNvkIgdhmocTe9EnTjK/5EMXiPNCymS7WwkeTfiGDk3+G1vquzLW7foxCzwoRLycczEj7u SI2PS8AnWjJqmuCA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 32F6F139B3; Thu, 26 Jan 2023 21:54:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id AId1CH/20mOcYgAAMHmgww (envelope-from ); Thu, 26 Jan 2023 21:54:07 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Thu, 26 Jan 2023 22:53:54 +0100 Message-Id: <20230126215401.29101-3-pvorel@suse.cz> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230126215401.29101-1-pvorel@suse.cz> References: <20230126215401.29101-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH 2/9] tst_net.sh: Check for disabled IPv6 in legacy tests X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Before tests timeout: # ./tcpdump01.sh -6 tcpdump01 1 TINFO: initialize 'lhost' 'ltp_ns_veth2' interface tcpdump01 1 TINFO: add local addr 10.0.0.2/24 tcpdump01 1 TINFO: initialize 'rhost' 'ltp_ns_veth1' interface tcpdump01 1 TINFO: add remote addr 10.0.0.1/24 tcpdump01 1 TINFO: Network config (local -- remote): tcpdump01 1 TINFO: ltp_ns_veth2 -- ltp_ns_veth1 tcpdump01 1 TINFO: 10.0.0.2/24 -- 10.0.0.1/24 tcpdump01 1 TINFO: fd00:1:1:1::2/64/ -- fd00:1:1:1::1/64/ tcpdump01 1 TINFO: start ping6 in background tcpdump01 1 TINFO: running tcpdump... (timeout) With this patch: tcpdump01 1 TINFO: initialize 'lhost' 'ltp_ns_veth2' interface ... tcpdump01 1 TCONF: IPv6 disabled Signed-off-by: Petr Vorel --- testcases/lib/tst_net.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh index 925cf50e1c..b76734210a 100644 --- a/testcases/lib/tst_net.sh +++ b/testcases/lib/tst_net.sh @@ -1094,6 +1094,7 @@ export NS_ICMPV6_SENDER_DATA_MAXSIZE=1452 # in the following document: testcases/network/stress/README if [ -n "$TST_USE_LEGACY_API" ]; then + [ "$TST_IPVER" = 6 ] && tst_net_require_ipv6 tst_net_remote_tmpdir fi From patchwork Thu Jan 26 21:53:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1732592 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=sJx9jLiJ; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=oYkSlbRw; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P2vcp0Jt9z23hC for ; Fri, 27 Jan 2023 08:54:34 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 255413CD354 for ; Thu, 26 Jan 2023 22:54:32 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [217.194.8.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 59A0A3CC77B for ; Thu, 26 Jan 2023 22:54:08 +0100 (CET) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id DCBEF1000A5E for ; Thu, 26 Jan 2023 22:54:07 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 9BADF1FF2E; Thu, 26 Jan 2023 21:54:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1674770047; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SsHAT0ECd/D4JtsUBEI4Y70oYCdfJxmBS1FMBd2gqnA=; b=sJx9jLiJboBJsGJhmb8n1ab4RUsv13buJG348QTu/eNew3bboa2SoLhjkHe25cUdo1HUXk wwGx0YhsBjrj4rVsv1PSiZo93X9Gou3FVGU/yGzpbQte8BT5xzxT7aClJyP3GgJXYsReFp HmwY4gOsqtkMWXe231AaJQPuyjER3Cg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1674770047; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SsHAT0ECd/D4JtsUBEI4Y70oYCdfJxmBS1FMBd2gqnA=; b=oYkSlbRwvY8GjI8ZppgHNmvSHpt83IQVBnuW6D1fzlgDHIiCs2oQd8TMbaCC8tOEqG7cPh 3unaTKoYUIqz3HDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6D56F139B3; Thu, 26 Jan 2023 21:54:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8GJTGH/20mOcYgAAMHmgww (envelope-from ); Thu, 26 Jan 2023 21:54:07 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Thu, 26 Jan 2023 22:53:55 +0100 Message-Id: <20230126215401.29101-4-pvorel@suse.cz> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230126215401.29101-1-pvorel@suse.cz> References: <20230126215401.29101-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH 3/9] tst_net.sh: Remove unneeded $_tst_net_parse_variables X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" $_tst_net_parse_variables guarder (originally introduced as $TST_PARSE_VARIABLES in 9aab3ffd55) was not needed any more since a93c34f914 which introduced $TST_LIB_NET_LOADED guarder at the top of the file. was used as a guarder to protect running configuration in case tst_net.sh was loaded more times. Fixes: a93c34f914 ("tst_net.sh: Introduce TST_LIB_NET_LOADED") Signed-off-by: Petr Vorel --- testcases/lib/tst_net.sh | 54 ++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh index b76734210a..1b3a7e6683 100644 --- a/testcases/lib/tst_net.sh +++ b/testcases/lib/tst_net.sh @@ -1005,47 +1005,41 @@ IPV6_RHOST="${IPV6_RHOST:-fd00:1:1:1::1/64}" # tst_net_ip_prefix -h # tst_net_iface_prefix -h # tst_net_vars -h -if [ -z "$_tst_net_parse_variables" ]; then - eval $(tst_net_ip_prefix $IPV4_LHOST || echo "exit $?") - eval $(tst_net_ip_prefix -r $IPV4_RHOST || echo "exit $?") +eval $(tst_net_ip_prefix $IPV4_LHOST || echo "exit $?") +eval $(tst_net_ip_prefix -r $IPV4_RHOST || echo "exit $?") - [ "$TST_NET_IPV6_ENABLED" = 1 ] && tst_net_detect_ipv6 rhost +[ "$TST_NET_IPV6_ENABLED" = 1 ] && tst_net_detect_ipv6 rhost - if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then - eval $(tst_net_ip_prefix $IPV6_LHOST || echo "exit $?") - eval $(tst_net_ip_prefix -r $IPV6_RHOST || echo "exit $?") - fi +if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then + eval $(tst_net_ip_prefix $IPV6_LHOST || echo "exit $?") + eval $(tst_net_ip_prefix -r $IPV6_RHOST || echo "exit $?") fi [ -n "$TST_USE_NETNS" -a "$TST_INIT_NETNS" != "no" ] && init_ltp_netspace -if [ -z "$_tst_net_parse_variables" ]; then - eval $(tst_net_iface_prefix $IPV4_LHOST || echo "exit $?") - eval $(tst_rhost_run -c 'tst_net_iface_prefix -r '$IPV4_RHOST \ - || echo "exit $?") - - if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then - eval $(tst_net_iface_prefix $IPV6_LHOST || echo "exit $?") - eval $(tst_rhost_run -c 'tst_net_iface_prefix -r '$IPV6_RHOST \ - || echo "exit $?") - fi - - eval $(tst_net_vars $IPV4_LHOST/$IPV4_LPREFIX \ - $IPV4_RHOST/$IPV4_RPREFIX || echo "exit $?") +eval $(tst_net_iface_prefix $IPV4_LHOST || echo "exit $?") +eval $(tst_rhost_run -c 'tst_net_iface_prefix -r '$IPV4_RHOST \ + || echo "exit $?") - if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then - eval $(tst_net_vars $IPV6_LHOST/$IPV6_LPREFIX \ - $IPV6_RHOST/$IPV6_RPREFIX || echo "exit $?") - fi +if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then + eval $(tst_net_iface_prefix $IPV6_LHOST || echo "exit $?") + eval $(tst_rhost_run -c 'tst_net_iface_prefix -r '$IPV6_RHOST \ + || echo "exit $?") +fi - tst_res_ TINFO "Network config (local -- remote):" - tst_res_ TINFO "$LHOST_IFACES -- $RHOST_IFACES" - tst_res_ TINFO "$IPV4_LHOST/$IPV4_LPREFIX -- $IPV4_RHOST/$IPV4_RPREFIX" - tst_res_ TINFO "$IPV6_LHOST/$IPV6_LPREFIX -- $IPV6_RHOST/$IPV6_RPREFIX" +eval $(tst_net_vars $IPV4_LHOST/$IPV4_LPREFIX \ + $IPV4_RHOST/$IPV4_RPREFIX || echo "exit $?") - export _tst_net_parse_variables="yes" +if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then + eval $(tst_net_vars $IPV6_LHOST/$IPV6_LPREFIX \ + $IPV6_RHOST/$IPV6_RPREFIX || echo "exit $?") fi +tst_res_ TINFO "Network config (local -- remote):" +tst_res_ TINFO "$LHOST_IFACES -- $RHOST_IFACES" +tst_res_ TINFO "$IPV4_LHOST/$IPV4_LPREFIX -- $IPV4_RHOST/$IPV4_RPREFIX" +tst_res_ TINFO "$IPV6_LHOST/$IPV6_LPREFIX -- $IPV6_RHOST/$IPV6_RPREFIX" + export TST_NET_DATAROOT="$LTPROOT/testcases/bin/datafiles" export TST_NETLOAD_CLN_REQUESTS="${TST_NETLOAD_CLN_REQUESTS:-10000}" From patchwork Thu Jan 26 21:53:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1732594 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=KJcDU1MT; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=4VQZrvbY; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P2vdC0VpCz23hC for ; Fri, 27 Jan 2023 08:54:55 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 1BED03CD362 for ; Thu, 26 Jan 2023 22:54:53 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [IPv6:2001:4b78:1:20::6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 759453CC75C for ; Thu, 26 Jan 2023 22:54:09 +0100 (CET) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id A423814010FB for ; Thu, 26 Jan 2023 22:54:08 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id CFBDC1F8A8; Thu, 26 Jan 2023 21:54:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1674770047; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GETrtImuGVaJDIuSVddU6IQEW7phT8/t00L+uMsr9Kc=; b=KJcDU1MTXvFMdHbiihyDUIQIXc27CCE8GEo9MOnptC+GFdNejIy8aIBa2Y1EIHAb8ZXx0x REv/kzdVc6C4c3MIeifJH0rQdMMBxpxogp1yUwMrThNNNCJ32sB/k6QqhAZdUWnIRJ5W3C BPHX46Au4iUqa8SIqI6sbvb4FbGQOVg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1674770047; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GETrtImuGVaJDIuSVddU6IQEW7phT8/t00L+uMsr9Kc=; b=4VQZrvbYIrZ6UgGwUjojCLdmJrwHtBPKxKMdQ8OnvOFkG0d76eI0w0VXgYEiKDPanBCXd4 Eqj00M5LsKhjorBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A6FD5139B3; Thu, 26 Jan 2023 21:54:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 4DHRJn/20mOcYgAAMHmgww (envelope-from ); Thu, 26 Jan 2023 21:54:07 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Thu, 26 Jan 2023 22:53:56 +0100 Message-Id: <20230126215401.29101-5-pvorel@suse.cz> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230126215401.29101-1-pvorel@suse.cz> References: <20230126215401.29101-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH 4/9] tst_net.sh: Remove unneeded $TST_INIT_NETNS variable X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Similarly to the previous commit, also $TST_INIT_NETNS guarder is not needed since a93c34f914 which introduced $TST_LIB_NET_LOADED guarder at the top of the file. Also use tst_net_use_netns() instead of the variable (encapsulation). Fixes: a93c34f914 ("tst_net.sh: Introduce TST_LIB_NET_LOADED") Signed-off-by: Petr Vorel --- testcases/lib/tst_net.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh index 1b3a7e6683..425f0b8b7e 100644 --- a/testcases/lib/tst_net.sh +++ b/testcases/lib/tst_net.sh @@ -150,8 +150,6 @@ init_ltp_netspace() LHOST_IFACES="${LHOST_IFACES:-ltp_ns_veth2}" RHOST_IFACES="${RHOST_IFACES:-ltp_ns_veth1}" - export TST_INIT_NETNS="no" - pid="$(echo $(readlink /var/run/netns/ltp_ns) | cut -f3 -d'/')" export LTP_NETNS="${LTP_NETNS:-ns_exec $pid net,mnt}" @@ -1015,7 +1013,7 @@ if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then eval $(tst_net_ip_prefix -r $IPV6_RHOST || echo "exit $?") fi -[ -n "$TST_USE_NETNS" -a "$TST_INIT_NETNS" != "no" ] && init_ltp_netspace +tst_net_use_netns && init_ltp_netspace eval $(tst_net_iface_prefix $IPV4_LHOST || echo "exit $?") eval $(tst_rhost_run -c 'tst_net_iface_prefix -r '$IPV4_RHOST \ From patchwork Thu Jan 26 21:53:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1732596 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=pE4d9ouM; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=47UV1bjq; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P2vdb1hlCz23h7 for ; Fri, 27 Jan 2023 08:55:15 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id DF34B3CD369 for ; Thu, 26 Jan 2023 22:55:12 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 121683CC7D8 for ; Thu, 26 Jan 2023 22:54:10 +0100 (CET) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id B4B67600568 for ; Thu, 26 Jan 2023 22:54:09 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 2AE9021CAA; Thu, 26 Jan 2023 21:54:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1674770048; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9wAxqHijwufWoS6rlf9OWhjtyA5KgJHZTfwzYVFFj5M=; b=pE4d9ouMkDxtmckkSxxn5f60Q3hbA3q4Ks0p3e1jbh5/pQEGELThUCLNtLNqJbZRYjLZSd ZV1PKAc6Gxj5jwD0pSzMCcT8Q3y8mM4/TJBIR0g4TT/mZVM7xOy8Xy8Rovnv0D4JF0UxS3 CkHoLu94o1fNdK3u0D0ih2W+z7vDZ4g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1674770048; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9wAxqHijwufWoS6rlf9OWhjtyA5KgJHZTfwzYVFFj5M=; b=47UV1bjqvnSabtseWih+zoUvyHBNBpIjHBh/k6YgbCcfJchVEzEZb1Ptz7VwWwQq9s6vd4 pllsZt554komxxAw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E6896139B3; Thu, 26 Jan 2023 21:54:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ACNUM3/20mOcYgAAMHmgww (envelope-from ); Thu, 26 Jan 2023 21:54:07 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Thu, 26 Jan 2023 22:53:57 +0100 Message-Id: <20230126215401.29101-6-pvorel@suse.cz> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230126215401.29101-1-pvorel@suse.cz> References: <20230126215401.29101-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH 5/9] tst_net.sh: Add more tst_require_cmds check X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Wei Gao More strict check for ns_xxx etc will help avoid following issue: https://github.com/linux-test-project/ltp/issues/991 Suggested-by: Petr Vorel Signed-off-by: Wei Gao [ removed checks in tst_rhost_run() - need to be fixed differently, check for more tools ] Signed-off-by: Petr Vorel --- testcases/lib/tst_net.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh index 425f0b8b7e..6cb9f02a5f 100644 --- a/testcases/lib/tst_net.sh +++ b/testcases/lib/tst_net.sh @@ -1003,6 +1003,7 @@ IPV6_RHOST="${IPV6_RHOST:-fd00:1:1:1::1/64}" # tst_net_ip_prefix -h # tst_net_iface_prefix -h # tst_net_vars -h +tst_require_cmds tst_net_iface_prefix tst_net_ip_prefix tst_net_vars eval $(tst_net_ip_prefix $IPV4_LHOST || echo "exit $?") eval $(tst_net_ip_prefix -r $IPV4_RHOST || echo "exit $?") From patchwork Thu Jan 26 21:53:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1732595 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=sjL0J1nO; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=1U1Dxu1v; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P2vdQ1tzyz23hg for ; Fri, 27 Jan 2023 08:55:06 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 3C1DB3CD35F for ; Thu, 26 Jan 2023 22:55:04 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [IPv6:2001:4b78:1:20::6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 08EE73CC7C7 for ; Thu, 26 Jan 2023 22:54:10 +0100 (CET) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id E87C814010FC for ; Thu, 26 Jan 2023 22:54:08 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 6678521CBE; Thu, 26 Jan 2023 21:54:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1674770048; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FFW+cU2mo0aueEbbXhGdYftJB8DJTJI5APmB0Z0sa78=; b=sjL0J1nOGgY/Yn9j1qgtMlRV/1Xp8SgDtX1syd01LPLENzM9DWe3gObyy2srx0vqC0hZsO g20Bil/N5xVtvgkFqebC864KtucWz2q6onJMCB/C+CDngbtG8GZvfHAQuQxnoMRx761Hy3 wo15Jfe9fVcB4BzLHtKMPqRTjBua3Lw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1674770048; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FFW+cU2mo0aueEbbXhGdYftJB8DJTJI5APmB0Z0sa78=; b=1U1Dxu1v8BlqvfhtEaHgQm7vrnoK2Y/QCyDeT4WIj1I51O0yMgsGPtfUk4QAHcD9vMn99h o2gwFUXHJRs20NDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3932E139B3; Thu, 26 Jan 2023 21:54:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id cA74C4D20mOcYgAAMHmgww (envelope-from ); Thu, 26 Jan 2023 21:54:08 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Thu, 26 Jan 2023 22:53:58 +0100 Message-Id: <20230126215401.29101-7-pvorel@suse.cz> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230126215401.29101-1-pvorel@suse.cz> References: <20230126215401.29101-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH 6/9] tst_net.sh: Rename function + add doc X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Rename tst_net_detect_ipv6() to tst_net_detect_ipv6_cmdline() because there will be another function to detect IPv6 disabled via sysctl. Signed-off-by: Petr Vorel --- testcases/lib/tst_net.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh index 6cb9f02a5f..3a9c16f070 100644 --- a/testcases/lib/tst_net.sh +++ b/testcases/lib/tst_net.sh @@ -100,7 +100,10 @@ tst_brk_() [ -z "$TST_USE_LEGACY_API" ] && tst_brk $@ || tst_brkm $@ } -tst_net_detect_ipv6() +# detect IPv6 not disabled via ipv6.disable=1 kernel cmdline parameter +# or via CONFIG_IPV6=y kernel configure option +# $TST_NET_IPV6_ENABLED: 1 (enabled), 0 (disabled) +tst_net_detect_ipv6_cmdline() { local type="${1:-lhost}" local cmd='[ -f /proc/net/if_inet6 ]' @@ -970,7 +973,7 @@ tst_default_max_pkt() [ -n "$TST_USE_LEGACY_API" ] && . test.sh || . tst_test.sh # detect IPv6 support on lhost for tests which don't use test links -tst_net_detect_ipv6 +tst_net_detect_ipv6_cmdline [ -n "$TST_NET_SKIP_VARIABLE_INIT" ] && return 0 @@ -1007,7 +1010,7 @@ tst_require_cmds tst_net_iface_prefix tst_net_ip_prefix tst_net_vars eval $(tst_net_ip_prefix $IPV4_LHOST || echo "exit $?") eval $(tst_net_ip_prefix -r $IPV4_RHOST || echo "exit $?") -[ "$TST_NET_IPV6_ENABLED" = 1 ] && tst_net_detect_ipv6 rhost +[ "$TST_NET_IPV6_ENABLED" = 1 ] && tst_net_detect_ipv6_cmdline rhost if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then eval $(tst_net_ip_prefix $IPV6_LHOST || echo "exit $?") From patchwork Thu Jan 26 21:53:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1732598 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=THNeee9u; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=CHyaL/6D; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P2vf00QVPz23h7 for ; Fri, 27 Jan 2023 08:55:36 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id D5BE33CD34F for ; Thu, 26 Jan 2023 22:55:33 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [217.194.8.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 227013CD351 for ; Thu, 26 Jan 2023 22:54:10 +0100 (CET) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id C74F1601357 for ; Thu, 26 Jan 2023 22:54:09 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 9E5AB21CDA; Thu, 26 Jan 2023 21:54:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1674770048; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V+coZMfdIxH0MIoLlumza3DGHqOAPIwOoCAshKdHYvw=; b=THNeee9uQBG/JiKkTJ7P5eWH7NAklzFu5cA9x6iUwcYoHL5jARFqu2xAXrhUE+IkrXCdPz 2DJnY0y4pXUa1+FW1qATtqZ0Xu0WniXb8VQKdVSSEa9TJvOHzXYkqxC93ESfCNjhqyRTQs 7JLLlqMcaLsnqNALFqOWYfW+j1pceag= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1674770048; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V+coZMfdIxH0MIoLlumza3DGHqOAPIwOoCAshKdHYvw=; b=CHyaL/6DTZ0dJmLdJRhZFDiPklfhkpB6dqh5hQc5ymLRe9MzbGIgc+2FnqT4zcB1xsmYPM AURVY8tAr13vcVCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 71CDD139B3; Thu, 26 Jan 2023 21:54:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id YDQpGoD20mOcYgAAMHmgww (envelope-from ); Thu, 26 Jan 2023 21:54:08 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Thu, 26 Jan 2023 22:53:59 +0100 Message-Id: <20230126215401.29101-8-pvorel@suse.cz> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230126215401.29101-1-pvorel@suse.cz> References: <20230126215401.29101-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-2.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-2.smtp.seeweb.it Subject: [LTP] [PATCH 7/9] tst_net.sh: Remove unused variable ret X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" $? is enough in tst_net_detect_ipv6_cmdline(). Signed-off-by: Petr Vorel --- testcases/lib/tst_net.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh index 3a9c16f070..518a3ed579 100644 --- a/testcases/lib/tst_net.sh +++ b/testcases/lib/tst_net.sh @@ -100,23 +100,20 @@ tst_brk_() [ -z "$TST_USE_LEGACY_API" ] && tst_brk $@ || tst_brkm $@ } -# detect IPv6 not disabled via ipv6.disable=1 kernel cmdline parameter -# or via CONFIG_IPV6=y kernel configure option -# $TST_NET_IPV6_ENABLED: 1 (enabled), 0 (disabled) +# Detect IPv6 disabled via ipv6.disable=1 kernel cmdline parameter +# or via CONFIG_IPV6=y kernel configure option. tst_net_detect_ipv6_cmdline() { local type="${1:-lhost}" local cmd='[ -f /proc/net/if_inet6 ]' - local ret if [ "$type" = "lhost" ]; then $cmd else tst_rhost_run -c "$cmd" fi - ret=$? - if [ $ret -eq 0 ]; then + if [ $? -eq 0 ]; then TST_NET_IPV6_ENABLED=1 else TST_NET_IPV6_ENABLED=0 From patchwork Thu Jan 26 21:54:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1732599 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=DRzk0Lje; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=4+sfL76i; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P2vfB2N7jz23h7 for ; Fri, 27 Jan 2023 08:55:46 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 1C8BF3CC797 for ; Thu, 26 Jan 2023 22:55:44 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id BA4B23CD354 for ; Thu, 26 Jan 2023 22:54:10 +0100 (CET) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id BCDB11000A5E for ; Thu, 26 Jan 2023 22:54:09 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D3D7821CE0; Thu, 26 Jan 2023 21:54:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1674770048; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uSlqSulkOhhl6S44JHoPABKoxo2SW/5X43ERAj8X6fU=; b=DRzk0LjeVYXyXyr6pJV9iSeIRbteM+lrL1pxfUhIVSBsxZItebeEWehmy84TyBY35RbFnS LdWEKVWDKgqlcu/ZUEj+o9zaGICoQog2agjjD4tLU/YKJjrynikeGeOscX6xrY+8anUhVS 42BCQKN+eR8FtJOdk0V2SRs2xkDbKlM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1674770048; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uSlqSulkOhhl6S44JHoPABKoxo2SW/5X43ERAj8X6fU=; b=4+sfL76ill3FH0CmRxAkGRlvYNoPIi1VRDprFyEfsizcF/ZZXB/Z086BKRESe/fIoHEEF0 wLeTmYXMENVhZtBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A9500139B3; Thu, 26 Jan 2023 21:54:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 4ElKJ4D20mOcYgAAMHmgww (envelope-from ); Thu, 26 Jan 2023 21:54:08 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Thu, 26 Jan 2023 22:54:00 +0100 Message-Id: <20230126215401.29101-9-pvorel@suse.cz> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230126215401.29101-1-pvorel@suse.cz> References: <20230126215401.29101-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH 8/9] tst_net.sh: Harden on disabled IPv6 via sysctl X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Detect IPv6 can be disabled via sysctl (for both netns or on ssh based links) and tests than fails: # sysctl net.ipv6.conf.ltp_ns_veth2.disable_ipv6=1 # TST_NET_RHOST_RUN_DEBUG=1 ./ping02.sh -6 ping02 1 TINFO: tst_rhost_run: cmd: [ -f /proc/net/if_inet6 ] ping02 1 TINFO: NETNS: sh -c " [ -f /proc/net/if_inet6 ] || echo RTERR" 2>&1 ping02 1 TINFO: initialize 'lhost' 'ltp_ns_veth2' interface ping02 1 TINFO: add local addr 10.0.0.2/24 ping02 1 TINFO: add local addr fd00:1:1:1::2/64 RTNETLINK answers: Permission denied ping02 1 TINFO: initialize 'rhost' 'ltp_ns_veth1' interface ... ping02 1 TINFO: timeout per run is 0h 5m 0s ping6: connect: Network is unreachable ping02 1 TFAIL: ping6 -I ltp_ns_veth2 -c 3 -s 8 -f -p 000102030405060708090a0b0c0d0e0f fd00:1:1:1::1 >/dev/null failed unexpectedly Therefore detect IPv6 disabled via sysctl: 1) tst_init_iface - to avoid setting net.ipv6.conf.$iface.accept_dad=0. tst_init_iface is called by tst_restore_ipaddr, which is called by init_ltp_netspace (netns) at the start of testing. 2) For ssh are all devices tested at the start. There are guards in both functions to avoid repeated checks (e.g. tst_restore_ipaddr() it's also cleanup function for some tests therefore called by both netns and ssh). Signed-off-by: Petr Vorel --- testcases/lib/tst_net.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh index 518a3ed579..7ee8594a54 100644 --- a/testcases/lib/tst_net.sh +++ b/testcases/lib/tst_net.sh @@ -126,6 +126,43 @@ tst_net_require_ipv6() [ "$TST_NET_IPV6_ENABLED" = 1 ] || tst_brk_ TCONF "IPv6 disabled" } +# Detect IPv6 disabled via sysctl. +tst_net_detect_ipv6_sysctl() +{ + [ "$TST_NET_IPV6_ENABLED" = 1 ] || return 1 + + local iface="$1" + local type="${2:-lhost}" + local check="sysctl -n net.ipv6.conf.$iface.disable_ipv6" + local disabled + + if [ "$type" = "lhost" ]; then + disabled=$($check) + else + disabled=$(tst_rhost_run -c "$check") + fi + if [ $disabled = 1 ]; then + tst_res_ TINFO "IPv6 disabled on $type on $iface" + TST_NET_IPV6_ENABLED=0 + return 1 + fi + + return 0 +} + +tst_net_check_ifaces_ipv6() +{ + local iface + + for iface in $(tst_get_ifaces); do + tst_net_detect_ipv6_sysctl || return + done + + for iface in $(tst_get_ifaces rhost); do + tst_net_detect_ipv6_sysctl $iface rhost || return + done +} + init_ltp_netspace() { local pid @@ -531,7 +568,9 @@ tst_init_iface() local type="${1:-lhost}" local link_num="${2:-0}" local iface="$(tst_iface $type $link_num)" + tst_res_ TINFO "initialize '$type' '$iface' interface" + tst_net_detect_ipv6_sysctl $iface $type if [ "$type" = "lhost" ]; then if ip xfrm state 1>/dev/null 2>&1; then @@ -1015,6 +1054,7 @@ if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then fi tst_net_use_netns && init_ltp_netspace +tst_net_check_ifaces_ipv6 eval $(tst_net_iface_prefix $IPV4_LHOST || echo "exit $?") eval $(tst_rhost_run -c 'tst_net_iface_prefix -r '$IPV4_RHOST \ From patchwork Thu Jan 26 21:54:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1732597 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=Vf7J6g6b; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=pkClLSsL; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P2vdm6dYVz23h7 for ; Fri, 27 Jan 2023 08:55:24 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 0C0763CC7C8 for ; Thu, 26 Jan 2023 22:55:23 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 226B53CD34F for ; Thu, 26 Jan 2023 22:54:10 +0100 (CET) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 6F4E714010FD for ; Thu, 26 Jan 2023 22:54:09 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 0FD191F8A8; Thu, 26 Jan 2023 21:54:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1674770049; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MboRKtqf6AKC+lmYv+Xo4yQJWonfND0l9rTA5wy749Y=; b=Vf7J6g6bDCkOOIu0b3SV8LJFmq897gPwGNLsoFgpD9kB/J4NPkRdD42iICJ1mzOpUv9/KT pHTrEr3Z3j1EI0oLmS4OJVwyBRzt7WEP4RaTLtmHpz/BEsHDoun6w/2YnaC25CCVZcpBhW kDyon63z75ra5xtzROwf6kTf1oty/0U= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1674770049; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MboRKtqf6AKC+lmYv+Xo4yQJWonfND0l9rTA5wy749Y=; b=pkClLSsL6FQG0hwutL4yVd7QK5v7jQDRyvco7rRVV+evKziNSIIM+UD2nyJ1JNEsSTZI65 nrvZXRiN2uyt/yBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id DBFAC139B3; Thu, 26 Jan 2023 21:54:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kNEtNID20mOcYgAAMHmgww (envelope-from ); Thu, 26 Jan 2023 21:54:08 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Thu, 26 Jan 2023 22:54:01 +0100 Message-Id: <20230126215401.29101-10-pvorel@suse.cz> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230126215401.29101-1-pvorel@suse.cz> References: <20230126215401.29101-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH 9/9] tst_net.sh: Move net setup into separate function X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Having network setup in separate function helps readability. Test environment variables are for readability kept outside. Signed-off-by: Petr Vorel --- testcases/lib/tst_net.sh | 118 ++++++++++++++++++++------------------- 1 file changed, 61 insertions(+), 57 deletions(-) diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh index 7ee8594a54..490909907a 100644 --- a/testcases/lib/tst_net.sh +++ b/testcases/lib/tst_net.sh @@ -1006,6 +1006,64 @@ tst_default_max_pkt() echo "$((mtu + mtu / 10))" } +# Setup LTP network. +# Used tools: +# * tst_net_ip_prefix +# Strip prefix from IP address and save both If no prefix found sets +# default prefix. +# +# * tst_net_iface_prefix reads prefix and interface from rtnetlink. +# If nothing found sets default prefix value. +# +# * tst_net_vars exports environment variables related to test links and +# networks that aren't reachable through the test links. +# +# For full list of exported environment variables see: +# tst_net_ip_prefix -h +# tst_net_iface_prefix -h +# tst_net_vars -h +tst_net_setup_network() +{ + tst_require_cmds tst_net_iface_prefix tst_net_ip_prefix tst_net_vars + + eval $(tst_net_ip_prefix $IPV4_LHOST || echo "exit $?") + eval $(tst_net_ip_prefix -r $IPV4_RHOST || echo "exit $?") + + [ "$TST_NET_IPV6_ENABLED" = 1 ] && tst_net_detect_ipv6_cmdline rhost + + if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then + eval $(tst_net_ip_prefix $IPV6_LHOST || echo "exit $?") + eval $(tst_net_ip_prefix -r $IPV6_RHOST || echo "exit $?") + fi + + tst_net_use_netns && init_ltp_netspace + tst_net_check_ifaces_ipv6 + + eval $(tst_net_iface_prefix $IPV4_LHOST || echo "exit $?") + eval $(tst_rhost_run -c 'tst_net_iface_prefix -r '$IPV4_RHOST \ + || echo "exit $?") + eval $(tst_net_vars $IPV4_LHOST/$IPV4_LPREFIX \ + $IPV4_RHOST/$IPV4_RPREFIX || echo "exit $?") + + if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then + eval $(tst_net_iface_prefix $IPV6_LHOST || echo "exit $?") + eval $(tst_rhost_run -c 'tst_net_iface_prefix -r '$IPV6_RHOST \ + || echo "exit $?") + eval $(tst_net_vars $IPV6_LHOST/$IPV6_LPREFIX \ + $IPV6_RHOST/$IPV6_RPREFIX || echo "exit $?") + fi + + tst_res_ TINFO "Network config (local -- remote):" + tst_res_ TINFO "$LHOST_IFACES -- $RHOST_IFACES" + tst_res_ TINFO "$IPV4_LHOST/$IPV4_LPREFIX -- $IPV4_RHOST/$IPV4_RPREFIX" + tst_res_ TINFO "$IPV6_LHOST/$IPV6_LPREFIX -- $IPV6_RHOST/$IPV6_RPREFIX" + + if [ -n "$TST_USE_LEGACY_API" ]; then + tst_net_remote_tmpdir + [ "$TST_IPVER" = 6 ] && tst_net_require_ipv6 + fi +} + [ -n "$TST_USE_LEGACY_API" ] && . test.sh || . tst_test.sh # detect IPv6 support on lhost for tests which don't use test links @@ -1028,56 +1086,10 @@ IPV4_RHOST="${IPV4_RHOST:-10.0.0.1/24}" IPV6_LHOST="${IPV6_LHOST:-fd00:1:1:1::2/64}" IPV6_RHOST="${IPV6_RHOST:-fd00:1:1:1::1/64}" -# tst_net_ip_prefix -# Strip prefix from IP address and save both If no prefix found sets -# default prefix. -# -# tst_net_iface_prefix reads prefix and interface from rtnetlink. -# If nothing found sets default prefix value. -# -# tst_net_vars exports environment variables related to test links and -# networks that aren't reachable through the test links. -# -# For full list of exported environment variables see: -# tst_net_ip_prefix -h -# tst_net_iface_prefix -h -# tst_net_vars -h -tst_require_cmds tst_net_iface_prefix tst_net_ip_prefix tst_net_vars -eval $(tst_net_ip_prefix $IPV4_LHOST || echo "exit $?") -eval $(tst_net_ip_prefix -r $IPV4_RHOST || echo "exit $?") - -[ "$TST_NET_IPV6_ENABLED" = 1 ] && tst_net_detect_ipv6_cmdline rhost - -if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then - eval $(tst_net_ip_prefix $IPV6_LHOST || echo "exit $?") - eval $(tst_net_ip_prefix -r $IPV6_RHOST || echo "exit $?") -fi - -tst_net_use_netns && init_ltp_netspace -tst_net_check_ifaces_ipv6 - -eval $(tst_net_iface_prefix $IPV4_LHOST || echo "exit $?") -eval $(tst_rhost_run -c 'tst_net_iface_prefix -r '$IPV4_RHOST \ - || echo "exit $?") - -if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then - eval $(tst_net_iface_prefix $IPV6_LHOST || echo "exit $?") - eval $(tst_rhost_run -c 'tst_net_iface_prefix -r '$IPV6_RHOST \ - || echo "exit $?") -fi - -eval $(tst_net_vars $IPV4_LHOST/$IPV4_LPREFIX \ - $IPV4_RHOST/$IPV4_RPREFIX || echo "exit $?") - -if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then - eval $(tst_net_vars $IPV6_LHOST/$IPV6_LPREFIX \ - $IPV6_RHOST/$IPV6_RPREFIX || echo "exit $?") -fi +tst_net_setup_network -tst_res_ TINFO "Network config (local -- remote):" -tst_res_ TINFO "$LHOST_IFACES -- $RHOST_IFACES" -tst_res_ TINFO "$IPV4_LHOST/$IPV4_LPREFIX -- $IPV4_RHOST/$IPV4_RPREFIX" -tst_res_ TINFO "$IPV6_LHOST/$IPV6_LPREFIX -- $IPV6_RHOST/$IPV6_RPREFIX" +# More information about network parameters can be found +# in the following document: testcases/network/stress/README export TST_NET_DATAROOT="$LTPROOT/testcases/bin/datafiles" @@ -1123,14 +1135,6 @@ export RHOST_HWADDRS="${RHOST_HWADDRS:-$(tst_get_hwaddrs rhost)}" export NS_ICMPV4_SENDER_DATA_MAXSIZE=1472 export NS_ICMPV6_SENDER_DATA_MAXSIZE=1452 -# More information about network parameters can be found -# in the following document: testcases/network/stress/README - -if [ -n "$TST_USE_LEGACY_API" ]; then - [ "$TST_IPVER" = 6 ] && tst_net_require_ipv6 - tst_net_remote_tmpdir -fi - if [ -z "$TST_USE_LEGACY_API" ] && ! tst_cmd_available ping6; then ping6() {