The branch main has been updated by glebius:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=0020e1b617dc71142a5d0c1738e72deaabdfe756

commit 0020e1b617dc71142a5d0c1738e72deaabdfe756
Author:     Gleb Smirnoff <[email protected]>
AuthorDate: 2024-04-10 18:28:11 +0000
Commit:     Gleb Smirnoff <[email protected]>
CommitDate: 2024-04-10 18:28:11 +0000

    Revert "sendfile: mark it explicitly as a TCP only feature"
    
    This reverts commit 3b7aa842e27dcf07181f161b1abde0067ed51e97.
---
 sys/kern/kern_sendfile.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c
index 071c2fbbd436..323e7fcde07b 100644
--- a/sys/kern/kern_sendfile.c
+++ b/sys/kern/kern_sendfile.c
@@ -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);
 }

Reply via email to