sendfile() does currently not support SCTP sockets.

Therefore, fail the call.

Reviewed by:		markj@
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D24059
This commit is contained in:
Michael Tuexen 2020-03-13 18:38:28 +00:00
parent c0507192fa
commit db4493f7b6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=358965
2 changed files with 15 additions and 0 deletions

View File

@ -431,3 +431,12 @@ to
.Er EFAULT ,
if provided an invalid address for
.Fa sbytes .
The
.Fn sendfile
system call does not support SCTP sockets,
it will return
.Dv -1
and set
.Va errno
to
.Er EINVAL.

View File

@ -575,6 +575,12 @@ sendfile_getsock(struct thread *td, int s, struct file **sock_fp,
*so = (*sock_fp)->f_data;
if ((*so)->so_type != SOCK_STREAM)
return (EINVAL);
/*
* SCTP one-to-one style sockets currently don't work with
* sendfile(). So indicate EINVAL for now.
*/
if ((*so)->so_proto->pr_protocol == IPPROTO_SCTP)
return (EINVAL);
if (SOLISTENING(*so))
return (ENOTCONN);
return (0);