Linux does not support MSG_OOB for unix(4) or non-stream oriented socket,

return EOPNOTSUPP as a Linux does.

Reviewed by:	tijl
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D20409
This commit is contained in:
Dmitry Chagin 2019-05-30 14:21:51 +00:00
parent 1a15d60d0e
commit 1410bfe142
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=348418

View File

@ -939,11 +939,13 @@ linux_sendmsg_common(struct thread *td, l_int s, struct l_msghdr *msghdr,
struct iovec *iov;
socklen_t datalen;
struct sockaddr *sa;
struct socket *so;
sa_family_t sa_family;
struct file *fp;
void *data;
l_size_t len;
l_size_t clen;
int error;
int error, fflag;
error = copyin(msghdr, &linux_msg, sizeof(linux_msg));
if (error != 0)
@ -974,12 +976,30 @@ linux_sendmsg_common(struct thread *td, l_int s, struct l_msghdr *msghdr,
control = NULL;
if (linux_msg.msg_controllen >= sizeof(struct l_cmsghdr)) {
error = kern_getsockname(td, s, &sa, &datalen);
error = kern_getsockname(td, s, &sa, &datalen);
if (error != 0)
goto bad;
sa_family = sa->sa_family;
free(sa, M_SONAME);
if (flags & LINUX_MSG_OOB) {
error = EOPNOTSUPP;
if (sa_family == AF_UNIX)
goto bad;
error = getsock_cap(td, s, &cap_send_rights, &fp,
&fflag, NULL);
if (error != 0)
goto bad;
sa_family = sa->sa_family;
free(sa, M_SONAME);
so = fp->f_data;
if (so->so_type != SOCK_STREAM)
error = EOPNOTSUPP;
fdrop(fp, td);
if (error != 0)
goto bad;
}
if (linux_msg.msg_controllen >= sizeof(struct l_cmsghdr)) {
error = ENOBUFS;
control = m_get(M_WAITOK, MT_CONTROL);