Revert "sendfile: mark it explicitly as a TCP only feature"

This reverts commit 3b7aa842e2.
This commit is contained in:
Gleb Smirnoff 2024-04-10 11:28:11 -07:00
parent 7a79d06697
commit 0020e1b617

View File

@ -649,16 +649,20 @@ sendfile_getsock(struct thread *td, int s, struct file **sock_fp,
*sock_fp = NULL;
*so = NULL;
/*
* The socket must be a stream socket and connected.
*/
error = getsock(td, s, &cap_send_rights, sock_fp);
if (error != 0)
return (error);
*so = (*sock_fp)->f_data;
if ((*so)->so_type != SOCK_STREAM)
return (EINVAL);
/*
* sendfile(2) should be supported for every SOCK_STREAM socket.
* However, the support of PF_UNIX/SOCK_STREAM is temporarily degraded
* and IPPROTO_SCTP isn't supported, yet.
* SCTP one-to-one style sockets currently don't work with
* sendfile(). So indicate EINVAL for now.
*/
if ((*so)->so_proto->pr_protocol != IPPROTO_TCP)
if ((*so)->so_proto->pr_protocol == IPPROTO_SCTP)
return (EINVAL);
return (0);
}