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-next>] [day] [month] [year] [list]
Message-ID: <53a579bc883e1bf2fe490d58427cf22c2d1aa21f.1680102695.git.petrm@nvidia.com>
Date:   Wed, 29 Mar 2023 17:24:53 +0200
From:   Petr Machata <petrm@...dia.com>
To:     "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, <netdev@...r.kernel.org>
CC:     David Ahern <dsahern@...nel.org>, Ido Schimmel <idosch@...dia.com>,
        "Petr Machata" <petrm@...dia.com>
Subject: [PATCH net-next] selftests: rtnetlink: Fix do_test_address_proto()

This selftest was introduced recently in the commit cited below. It misses
several check_err() invocations to actually verify that the previous
command succeeded. When these are added, the first one fails, because
besides the addresses added by hand, there can be a link-local address
added by the kernel. Adjust the check to expect at least three addresses
instead of exactly three, and add the missing check_err's.

Furthermore, the explanatory comments assume that the address with no
protocol is $addr2, when in fact it is $addr3. Update the comments.

Fixes: 6a414fd77f61 ("selftests: rtnetlink: Add an address proto test")
Signed-off-by: Petr Machata <petrm@...dia.com>
---
 tools/testing/selftests/net/rtnetlink.sh | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
index 3b15c686c03f..383ac6fc037d 100755
--- a/tools/testing/selftests/net/rtnetlink.sh
+++ b/tools/testing/selftests/net/rtnetlink.sh
@@ -1302,19 +1302,23 @@ do_test_address_proto()
 
 	count=$(address_count)
 	check_err $?
-	(( count == 3 )) # $addr, $addr2 and $addr3
+	(( count >= 3 )) # $addr, $addr2 and $addr3 plus any kernel addresses
+	check_err $?
 
 	count=$(address_count proto 0)
 	check_err $?
-	(( count == 1 )) # just $addr2
+	(( count == 1 )) # just $addr3
+	check_err $?
 
 	count=$(address_count proto 0x11)
 	check_err $?
-	(( count == 2 )) # $addr and $addr2
+	(( count == 2 )) # $addr and $addr3
+	check_err $?
 
 	count=$(address_count proto 0xab)
 	check_err $?
-	(( count == 1 )) # just $addr2
+	(( count == 1 )) # just $addr3
+	check_err $?
 
 	ip address del dev "$devdummy" "$addr"
 	ip address del dev "$devdummy" "$addr2"
-- 
2.39.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ