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: <20231222135836.992841-5-bpoirier@nvidia.com>
Date: Fri, 22 Dec 2023 08:58:30 -0500
From: Benjamin Poirier <bpoirier@...dia.com>
To: netdev@...r.kernel.org
Cc: Shuah Khan <shuah@...nel.org>,
	Petr Machata <petrm@...dia.com>,
	Hangbin Liu <liuhangbin@...il.com>,
	Vladimir Oltean <vladimir.oltean@....com>
Subject: [RFC PATCH net-next 04/10] selftests: forwarding: Simplify forwarding.config import logic

The first condition removed by this patch reimplements functionality that
is part of `dirname`:
$ dirname ""
.

Use the libdir variable introduced in the previous patch to import
forwarding.config without duplicating functionality.

Signed-off-by: Benjamin Poirier <bpoirier@...dia.com>
---
 tools/testing/selftests/net/forwarding/lib.sh | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index f9e32152f23d..481d9b655a40 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -29,16 +29,12 @@ STABLE_MAC_ADDRS=${STABLE_MAC_ADDRS:=no}
 TCPDUMP_EXTRA_FLAGS=${TCPDUMP_EXTRA_FLAGS:=}
 TROUTE6=${TROUTE6:=traceroute6}
 
-relative_path="${BASH_SOURCE%/*}"
-if [[ "$relative_path" == "${BASH_SOURCE}" ]]; then
-	relative_path="."
-fi
-
-if [[ -f $relative_path/forwarding.config ]]; then
-	source "$relative_path/forwarding.config"
-fi
-
 libdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
+
+if [ -f "$libdir"/forwarding.config ]; then
+       source "$libdir"/forwarding.config
+fi
+
 source "$libdir"/../lib.sh
 
 ##############################################################################
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ