tests: net: socket: udp: clear control data buffer before recvmsg

Currently, the test doesn't clear the control data buffer before
calling recvmsg. This leads to recvmsg being unable to add the new
control data, which corresponds to the current received data.
This commit aims to clear the control data buffer to match most use
cases, when the control data buffer is empty before calling recvmsg.

Signed-off-by: Axel Le Bourhis <axel.lebourhis@nxp.com>
This commit is contained in:
Axel Le Bourhis 2024-08-23 12:43:46 +02:00 committed by Fabio Baltieri
commit 179c85aa06

View file

@ -1492,6 +1492,7 @@ static void comm_sendmsg_recvmsg(int client_sock,
io_vector[0].iov_len = sizeof(buf);
memset(msg, 0, sizeof(*msg));
memset(cmsgbuf, 0, cmsgbuf_len);
msg->msg_control = cmsgbuf;
msg->msg_controllen = cmsgbuf_len;
msg->msg_iov = io_vector;
@ -1565,6 +1566,7 @@ static void comm_sendmsg_recvmsg(int client_sock,
io_vector[1].iov_len = sizeof(buf);
memset(msg, 0, sizeof(*msg));
memset(cmsgbuf, 0, cmsgbuf_len);
msg->msg_control = cmsgbuf;
msg->msg_controllen = cmsgbuf_len;
msg->msg_iov = io_vector;
@ -1624,6 +1626,7 @@ static void comm_sendmsg_recvmsg(int client_sock,
io_vector[0].iov_len = sizeof(buf2);
memset(msg, 0, sizeof(*msg));
memset(cmsgbuf, 0, cmsgbuf_len);
msg->msg_control = cmsgbuf;
msg->msg_controllen = cmsgbuf_len;
msg->msg_iov = io_vector;