The branch main has been updated by glebius:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=3b7aa842e27dcf07181f161b1abde0067ed51e97

commit 3b7aa842e27dcf07181f161b1abde0067ed51e97
Author:     Gleb Smirnoff <gleb...@freebsd.org>
AuthorDate: 2024-04-08 20:16:51 +0000
Commit:     Gleb Smirnoff <gleb...@freebsd.org>
CommitDate: 2024-04-08 20:16:51 +0000

    sendfile: mark it explicitly as a TCP only feature
    
    Back in 2015 when it turned non-blocking, it was working with PF_UNIX
    and it may still work.  However, the usefullness of such application
    of sendfile(2) is questionable.  Disable the feature while unix/stream
    is under refactoring.
    
    Relnotes:       yes
---
 sys/kern/kern_sendfile.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c
index 323e7fcde07b..071c2fbbd436 100644
--- a/sys/kern/kern_sendfile.c
+++ b/sys/kern/kern_sendfile.c
@@ -649,20 +649,16 @@ 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);
        /*
-        * SCTP one-to-one style sockets currently don't work with
-        * sendfile(). So indicate EINVAL for now.
+        * 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.
         */
-       if ((*so)->so_proto->pr_protocol == IPPROTO_SCTP)
+       if ((*so)->so_proto->pr_protocol != IPPROTO_TCP)
                return (EINVAL);
        return (0);
 }

Reply via email to