selftests/tls: add shutdown tests
Add test for killing the connection via shutdown. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
Родитель
8051bb7f2c
Коммит
d4d34185e7
|
@ -952,6 +952,33 @@ TEST_F(tls, control_msg)
|
|||
EXPECT_EQ(memcmp(buf, test_str, send_len), 0);
|
||||
}
|
||||
|
||||
TEST_F(tls, shutdown)
|
||||
{
|
||||
char const *test_str = "test_read";
|
||||
int send_len = 10;
|
||||
char buf[10];
|
||||
|
||||
ASSERT_EQ(strlen(test_str) + 1, send_len);
|
||||
|
||||
EXPECT_EQ(send(self->fd, test_str, send_len, 0), send_len);
|
||||
EXPECT_NE(recv(self->cfd, buf, send_len, 0), -1);
|
||||
EXPECT_EQ(memcmp(buf, test_str, send_len), 0);
|
||||
|
||||
shutdown(self->fd, SHUT_RDWR);
|
||||
shutdown(self->cfd, SHUT_RDWR);
|
||||
}
|
||||
|
||||
TEST_F(tls, shutdown_unsent)
|
||||
{
|
||||
char const *test_str = "test_read";
|
||||
int send_len = 10;
|
||||
|
||||
EXPECT_EQ(send(self->fd, test_str, send_len, MSG_MORE), send_len);
|
||||
|
||||
shutdown(self->fd, SHUT_RDWR);
|
||||
shutdown(self->cfd, SHUT_RDWR);
|
||||
}
|
||||
|
||||
TEST(non_established) {
|
||||
struct tls12_crypto_info_aes_gcm_256 tls12;
|
||||
struct sockaddr_in addr;
|
||||
|
|
Загрузка…
Ссылка в новой задаче