lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240423124908.2073400-3-lukma@denx.de>
Date: Tue, 23 Apr 2024 14:49:05 +0200
From: Lukasz Majewski <lukma@...x.de>
To: netdev@...r.kernel.org,
	Paolo Abeni <pabeni@...hat.com>,
	Casper Andersson <casper.casan@...il.com>
Cc: Andrew Lunn <andrew@...n.ch>,
	Eric Dumazet <edumazet@...gle.com>,
	Vladimir Oltean <olteanv@...il.com>,
	"David S. Miller" <davem@...emloft.net>,
	Jakub Kicinski <kuba@...nel.org>,
	Oleksij Rempel <o.rempel@...gutronix.de>,
	Tristram.Ha@...rochip.com,
	Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
	Ravi Gunasekaran <r-gunasekaran@...com>,
	Simon Horman <horms@...nel.org>,
	Nikita Zhandarovich <n.zhandarovich@...tech.ru>,
	Murali Karicheri <m-karicheri2@...com>,
	Jiri Pirko <jiri@...nulli.us>,
	Dan Carpenter <dan.carpenter@...aro.org>,
	Ziyang Xuan <william.xuanziyang@...wei.com>,
	Shigeru Yoshida <syoshida@...hat.com>,
	"Ricardo B. Marliere" <ricardo@...liere.net>,
	linux-kernel@...r.kernel.org,
	Lukasz Majewski <lukma@...x.de>
Subject: [net-next PATCH v6 2/5] test: hsr: Remove script code already implemented in lib.sh

Some parts (like netns creation and cleanup) of hsr_ping.sh script are
already implemented in ../lib.sh common script, so can be replaced by it.

Signed-off-by: Lukasz Majewski <lukma@...x.de>

---
Changes for v6:
- New patch
---
 tools/testing/selftests/net/hsr/hsr_ping.sh | 28 +++------------------
 1 file changed, 3 insertions(+), 25 deletions(-)

diff --git a/tools/testing/selftests/net/hsr/hsr_ping.sh b/tools/testing/selftests/net/hsr/hsr_ping.sh
index 1c6457e54625..bd7c4b8f07b8 100755
--- a/tools/testing/selftests/net/hsr/hsr_ping.sh
+++ b/tools/testing/selftests/net/hsr/hsr_ping.sh
@@ -1,6 +1,7 @@
 #!/bin/bash
 # SPDX-License-Identifier: GPL-2.0
 
+source ../lib.sh
 ret=0
 ksft_skip=4
 ipv6=true
@@ -27,19 +28,7 @@ while getopts "$optstring" option;do
 esac
 done
 
-sec=$(date +%s)
-rndh=$(printf %x $sec)-$(mktemp -u XXXXXX)
-ns1="ns1-$rndh"
-ns2="ns2-$rndh"
-ns3="ns3-$rndh"
-
-cleanup()
-{
-	local netns
-	for netns in "$ns1" "$ns2" "$ns3" ;do
-		ip netns del $netns
-	done
-}
+setup_ns ns1 ns2 ns3
 
 # $1: IP address
 is_v6()
@@ -254,21 +243,10 @@ if [ $? -ne 0 ];then
 	exit $ksft_skip
 fi
 
-trap cleanup EXIT
-
-for i in "$ns1" "$ns2" "$ns3" ;do
-	ip netns add $i || exit $ksft_skip
-	ip -net $i link set lo up
-done
+trap cleanup_all_ns EXIT
 
 setup_hsr_interfaces 0
 do_complete_ping_test
-cleanup
-
-for i in "$ns1" "$ns2" "$ns3" ;do
-	ip netns add $i || exit $ksft_skip
-	ip -net $i link set lo up
-done
 
 setup_hsr_interfaces 1
 do_complete_ping_test
-- 
2.20.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ