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: <20220210003649.3120861-8-kuba@kernel.org>
Date:   Wed,  9 Feb 2022 16:36:45 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     davem@...emloft.net
Cc:     netdev@...r.kernel.org, willemb@...gle.com, lorenzo@...gle.com,
        maze@...gle.com, dsahern@...nel.org, yoshfuji@...ux-ipv6.org,
        shuah@...nel.org, linux-kselftest@...r.kernel.org,
        Jakub Kicinski <kuba@...nel.org>
Subject: [PATCH net-next 07/11] selftests: net: cmsg_so_mark: test ICMP and RAW sockets

Use new capabilities of cmsg_sender to test ICMP and RAW sockets,
previously only UDP was tested.

Before SO_MARK support was added to ICMPv6:

  # ./cmsg_so_mark.sh
   Case ICMP rejection returned 0, expected 1
  FAIL - 1/12 cases failed

After:

  # ./cmsg_so_mark.sh
  OK

Signed-off-by: Jakub Kicinski <kuba@...nel.org>
---
 tools/testing/selftests/net/cmsg_so_mark.sh | 24 ++++++++++++++-------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/tools/testing/selftests/net/cmsg_so_mark.sh b/tools/testing/selftests/net/cmsg_so_mark.sh
index 841d706dc91b..925f6b9deee2 100755
--- a/tools/testing/selftests/net/cmsg_so_mark.sh
+++ b/tools/testing/selftests/net/cmsg_so_mark.sh
@@ -18,6 +18,8 @@ trap cleanup EXIT
 # Namespaces
 ip netns add $NS
 
+ip netns exec $NS sysctl -w net.ipv4.ping_group_range='0 2147483647' > /dev/null
+
 # Connectivity
 ip -netns $NS link add type dummy
 ip -netns $NS link set dev dummy0 up
@@ -41,15 +43,21 @@ check_result() {
     fi
 }
 
-ip netns exec $NS ./cmsg_sender -m $((MARK + 1)) $TGT4 1234
-check_result $? 0 "IPv4 pass"
-ip netns exec $NS ./cmsg_sender -m $((MARK + 1)) $TGT6 1234
-check_result $? 0 "IPv6 pass"
+for i in 4 6; do
+    [ $i == 4 ] && TGT=$TGT4 || TGT=$TGT6
+
+    for p in u i r; do
+	[ $p == "u" ] && prot=UDP
+	[ $p == "i" ] && prot=ICMP
+	[ $p == "r" ] && prot=RAW
+
+	ip netns exec $NS ./cmsg_sender -$i -p $p -m $((MARK + 1)) $TGT 1234
+	check_result $? 0 "$prot pass"
 
-ip netns exec $NS ./cmsg_sender -s -m $MARK $TGT4 1234
-check_result $? 1 "IPv4 rejection"
-ip netns exec $NS ./cmsg_sender -s -m $MARK $TGT6 1234
-check_result $? 1 "IPv6 rejection"
+	ip netns exec $NS ./cmsg_sender -$i -p $p -m $MARK -s $TGT 1234
+	check_result $? 1 "$prot rejection"
+    done
+done
 
 # Summary
 if [ $BAD -ne 0 ]; then
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ