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:
parent
5d643f4b00
commit
179c85aa06
1 changed files with 3 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue