mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
linux(4): Fix MSG_CTRUNC handling in recvmsg()
The MSG_CTRUNC flag of the msg_flags member of the message header is
set uppon successful completition if the control data was truncated.
Upon return from a successful call msg_controllen should contain the
length of the control message sequence.
Fixes: 0eda2cea
MFC after: 1 week
This commit is contained in:
parent
9d0c9b6d6a
commit
2467ccddc0
1 changed files with 2 additions and 3 deletions
|
|
@ -1835,8 +1835,8 @@ linux_recvmsg_common(struct thread *td, l_int s, struct l_msghdr *msghdr,
|
|||
if (error != 0)
|
||||
goto bad;
|
||||
|
||||
skiped = outlen = 0;
|
||||
maxlen = l_msghdr.msg_controllen;
|
||||
l_msghdr.msg_controllen = 0;
|
||||
if (control == NULL)
|
||||
goto out;
|
||||
|
||||
|
|
@ -1844,7 +1844,6 @@ linux_recvmsg_common(struct thread *td, l_int s, struct l_msghdr *msghdr,
|
|||
msg->msg_control = mtod(control, struct cmsghdr *);
|
||||
msg->msg_controllen = control->m_len;
|
||||
outbuf = PTRIN(l_msghdr.msg_control);
|
||||
skiped = outlen = 0;
|
||||
for (m = control; m != NULL; m = m->m_next) {
|
||||
cm = mtod(m, struct cmsghdr *);
|
||||
lcm->cmsg_type = bsd_to_linux_cmsg_type(p, cm->cmsg_type,
|
||||
|
|
@ -1910,9 +1909,9 @@ err:
|
|||
error = EINVAL;
|
||||
goto bad;
|
||||
}
|
||||
l_msghdr.msg_controllen = outlen;
|
||||
|
||||
out:
|
||||
l_msghdr.msg_controllen = outlen;
|
||||
error = copyout(&l_msghdr, msghdr, sizeof(l_msghdr));
|
||||
|
||||
bad:
|
||||
|
|
|
|||
Loading…
Reference in a new issue