Skip to content

Commit

Permalink
tests: net: socket: udp: clear control data buffer before recvmsg
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
axelnxp authored and fabiobaltieri committed Aug 23, 2024
1 parent 5d643f4 commit 179c85a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/net/socket/udp/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 179c85a

Please sign in to comment.