diff options
| -rw-r--r-- | tools/testing/selftests/net/tls.c | 34 | 
1 files changed, 34 insertions, 0 deletions
| diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c index e788b84551ca..77e4e30b46cc 100644 --- a/tools/testing/selftests/net/tls.c +++ b/tools/testing/selftests/net/tls.c @@ -564,6 +564,40 @@ TEST_F(tls, msg_more)  	EXPECT_EQ(memcmp(buf, test_str, send_len), 0);  } +TEST_F(tls, cmsg_msg_more) +{ +	char *test_str =  "test_read"; +	char record_type = 100; +	int send_len = 10; + +	/* we don't allow MSG_MORE with non-DATA records */ +	EXPECT_EQ(tls_send_cmsg(self->fd, record_type, test_str, send_len, +				MSG_MORE), -1); +	EXPECT_EQ(errno, EINVAL); +} + +TEST_F(tls, msg_more_then_cmsg) +{ +	char *test_str = "test_read"; +	char record_type = 100; +	int send_len = 10; +	char buf[10 * 2]; +	int ret; + +	EXPECT_EQ(send(self->fd, test_str, send_len, MSG_MORE), send_len); +	EXPECT_EQ(recv(self->cfd, buf, send_len, MSG_DONTWAIT), -1); + +	ret = tls_send_cmsg(self->fd, record_type, test_str, send_len, 0); +	EXPECT_EQ(ret, send_len); + +	/* initial DATA record didn't get merged with the non-DATA record */ +	EXPECT_EQ(recv(self->cfd, buf, send_len * 2, 0), send_len); + +	EXPECT_EQ(tls_recv_cmsg(_metadata, self->cfd, record_type, +				buf, sizeof(buf), MSG_WAITALL), +		  send_len); +} +  TEST_F(tls, msg_more_unsent)  {  	char const *test_str = "test_read"; | 
