Author: tuexen
Date: Sun Aug 23 21:35:23 2020
New Revision: 364550
URL: https://svnweb.freebsd.org/changeset/base/364550

Log:
  MFC r358965:
  sendfile() does currently not support SCTP sockets.
  Therefore, fail the call.
  Manually fix a compile issue.

Modified:
  stable/12/lib/libc/sys/sendfile.2
  stable/12/sys/kern/kern_sendfile.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/sys/sendfile.2
==============================================================================
--- stable/12/lib/libc/sys/sendfile.2   Sun Aug 23 21:27:54 2020        
(r364549)
+++ stable/12/lib/libc/sys/sendfile.2   Sun Aug 23 21:35:23 2020        
(r364550)
@@ -414,3 +414,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.

Modified: stable/12/sys/kern/kern_sendfile.c
==============================================================================
--- stable/12/sys/kern/kern_sendfile.c  Sun Aug 23 21:27:54 2020        
(r364549)
+++ stable/12/sys/kern/kern_sendfile.c  Sun Aug 23 21:35:23 2020        
(r364550)
@@ -53,6 +53,8 @@ __FBSDID("$FreeBSD$");
 
 #include <net/vnet.h>
 
+#include <netinet/in.h>
+
 #include <security/audit/audit.h>
 #include <security/mac/mac_framework.h>
 
@@ -507,6 +509,12 @@ sendfile_getsock(struct thread *td, int s, struct file
                return (error);
        *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);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to