On Sat, Sep 03, 2022 at 03:56:38AM +0300, Vitaliy Makkoveev wrote:
> Or may be better to check `pr_type' with the ability of splicing?

I don't think that makes sense.  Reasonable splicing does not depend
on the type of socket, not on the protocol family, but on the
protocol.  That is the reason I used the usrreq pointer before.  As
it involves sending packets, I suggested pru_send now.

You can splice tcp to tcp, and udp to udp.
You cannot splice udp to rip although both use pr_type SOCK_RAW.

I am not convinced that introducing sepecial IPv6 functions pointers
was a good idea.  That means a lot of code duplication.

Whatever.  With the current feature set your diff is equivalent to
any other solution discussed.  I have not implemented splicing for
rip or rip6 yet.

Regress is broken, fix it somehow and quickly.  OK bluhm@

> Index: sys/kern/uipc_socket.c
> ===================================================================
> RCS file: /cvs/src/sys/kern/uipc_socket.c,v
> retrieving revision 1.286
> diff -u -p -r1.286 uipc_socket.c
> --- sys/kern/uipc_socket.c    28 Aug 2022 18:43:12 -0000      1.286
> +++ sys/kern/uipc_socket.c    3 Sep 2022 00:53:39 -0000
> @@ -1293,7 +1293,8 @@ sosplice(struct socket *so, int fd, off_
>       if ((error = getsock(curproc, fd, &fp)) != 0)
>               return (error);
>       sosp = fp->f_data;
> -     if (sosp->so_proto->pr_usrreqs != so->so_proto->pr_usrreqs) {
> +     if ((sosp->so_proto->pr_flags & PR_SPLICE) == 0 ||
> +         (sosp->so_proto->pr_type != so->so_proto->pr_type)) {
>               error = EPROTONOSUPPORT;
>               goto frele;
>       }

Reply via email to