summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2019-07-29 19:08:03 -0400
committerDavid S. Miller <davem@davemloft.net>2019-07-31 18:53:36 -0400
commite29903c49990376e5e928b20f658cdf7c29bf1eb (patch)
treefa4fa144137e020b0c1f020fe2d93f00d7d72a81 /tools
parentd8a1de3d5bb881507602bc02e004904828f88711 (diff)
selftests/tls: fix TLS tests with CONFIG_TLS=n
Build bot reports some recent TLS tests are failing with CONFIG_TLS=n. Correct the expected return code and skip TLS installation if not supported. Tested with CONFIG_TLS=n and CONFIG_TLS=m. Reported-by: kernel test robot <rong.a.chen@intel.com> Fixes: cf32526c8842 ("selftests/tls: add a test for ULP but no keys") Fixes: 65d41fb317c6 ("selftests/tls: add a bidirectional test") Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/net/tls.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c
index 630c5b884d43..d995e6503b1a 100644
--- a/tools/testing/selftests/net/tls.c
+++ b/tools/testing/selftests/net/tls.c
@@ -69,7 +69,7 @@ FIXTURE_SETUP(tls_basic)
69 69
70 ret = setsockopt(self->fd, IPPROTO_TCP, TCP_ULP, "tls", sizeof("tls")); 70 ret = setsockopt(self->fd, IPPROTO_TCP, TCP_ULP, "tls", sizeof("tls"));
71 if (ret != 0) { 71 if (ret != 0) {
72 ASSERT_EQ(errno, ENOTSUPP); 72 ASSERT_EQ(errno, ENOENT);
73 self->notls = true; 73 self->notls = true;
74 printf("Failure setting TCP_ULP, testing without tls\n"); 74 printf("Failure setting TCP_ULP, testing without tls\n");
75 return; 75 return;
@@ -696,21 +696,26 @@ TEST_F(tls, recv_lowat)
696 696
697TEST_F(tls, bidir) 697TEST_F(tls, bidir)
698{ 698{
699 struct tls12_crypto_info_aes_gcm_128 tls12;
700 char const *test_str = "test_read"; 699 char const *test_str = "test_read";
701 int send_len = 10; 700 int send_len = 10;
702 char buf[10]; 701 char buf[10];
703 int ret; 702 int ret;
704 703
705 memset(&tls12, 0, sizeof(tls12)); 704 if (!self->notls) {
706 tls12.info.version = TLS_1_3_VERSION; 705 struct tls12_crypto_info_aes_gcm_128 tls12;
707 tls12.info.cipher_type = TLS_CIPHER_AES_GCM_128;
708 706
709 ret = setsockopt(self->fd, SOL_TLS, TLS_RX, &tls12, sizeof(tls12)); 707 memset(&tls12, 0, sizeof(tls12));
710 ASSERT_EQ(ret, 0); 708 tls12.info.version = TLS_1_3_VERSION;
709 tls12.info.cipher_type = TLS_CIPHER_AES_GCM_128;
711 710
712 ret = setsockopt(self->cfd, SOL_TLS, TLS_TX, &tls12, sizeof(tls12)); 711 ret = setsockopt(self->fd, SOL_TLS, TLS_RX, &tls12,
713 ASSERT_EQ(ret, 0); 712 sizeof(tls12));
713 ASSERT_EQ(ret, 0);
714
715 ret = setsockopt(self->cfd, SOL_TLS, TLS_TX, &tls12,
716 sizeof(tls12));
717 ASSERT_EQ(ret, 0);
718 }
714 719
715 ASSERT_EQ(strlen(test_str) + 1, send_len); 720 ASSERT_EQ(strlen(test_str) + 1, send_len);
716 721