Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Aug 2020 21:35:23 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r364550 - in stable/12: lib/libc/sys sys/kern
Message-ID:  <202008232135.07NLZNfF066745@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008232135.07NLZNfF066745>