[PATCH 16/19] selftests: Initial tcp_authopt support for fcnal-test

From: Leonard Crestez
Date: Tue Sep 21 2021 - 12:18:05 EST


Just test that a correct password is passed or otherwise a timeout is
obtained.

Signed-off-by: Leonard Crestez <cdleonard@xxxxxxxxx>
---
tools/testing/selftests/net/fcnal-test.sh | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh
index 13350cd5c8ac..74a7580b6bde 100755
--- a/tools/testing/selftests/net/fcnal-test.sh
+++ b/tools/testing/selftests/net/fcnal-test.sh
@@ -791,10 +791,31 @@ ipv4_ping()
}

################################################################################
# IPv4 TCP

+#
+# TCP Authentication Option Tests
+#
+ipv4_tcp_authopt()
+{
+ # basic use case
+ log_start
+ run_cmd nettest -s -A ${MD5_PW} &
+ sleep 1
+ run_cmd_nsb nettest -r ${NSA_IP} -A ${MD5_PW}
+ log_test $? 0 "AO: Simple password"
+
+ # wrong password
+ log_start
+ show_hint "Should timeout since client uses wrong password"
+ run_cmd nettest -s -A ${MD5_PW} &
+ sleep 1
+ run_cmd_nsb nettest -r ${NSA_IP} -A ${MD5_WRONG_PW}
+ log_test $? 2 "AO: Client uses wrong password"
+}
+
#
# MD5 tests without VRF
#
ipv4_tcp_md5_novrf()
{
@@ -1122,10 +1143,11 @@ ipv4_tcp_novrf()
show_hint "Should fail 'Connection refused'"
run_cmd nettest -d ${NSA_DEV} -r ${a}
log_test_addr ${a} $? 1 "No server, device client, local conn"

ipv4_tcp_md5_novrf
+ ipv4_tcp_authopt
}

ipv4_tcp_vrf()
{
local a
--
2.25.1