Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 03 Feb 2020 15:46:08 -0800
From:      "Kristof Provost" <kp@FreeBSD.org>
To:        "Rick Macklem" <rmacklem@uoguelph.ca>
Cc:        freebsd-net <freebsd-net@freebsd.org>
Subject:   Re: Does sosend() need CURVNET_SET/CURVNET_RESTORE?
Message-ID:  <C7EDCEEF-99F8-492D-8A6D-766F1E2774F7@FreeBSD.org>
In-Reply-To: <YTBPR01MB3374372120674C746D75F504DD000@YTBPR01MB3374.CANPRD01.PROD.OUTLOOK.COM>
References:  <YTBPR01MB337446173B7D480145BBB6C6DD010@YTBPR01MB3374.CANPRD01.PROD.OUTLOOK.COM> <E4E34E8E-0EE1-41FC-A365-1070DF16B076@FreeBSD.org> <YTBPR01MB3374372120674C746D75F504DD000@YTBPR01MB3374.CANPRD01.PROD.OUTLOOK.COM>

next in thread | previous in thread | raw e-mail | index | archive | help
On 3 Feb 2020, at 14:59, Rick Macklem wrote:
> Kristof Provost wrote:
>> On 2 Feb 2020, at 13:22, Rick Macklem wrote:
>>> The current krpc code calls sosend() and soreceive() without any
>>> CURVNET_SET()/CURVNET_RESTORE() wrapped around them.
>>>
>> sosend() and soreceive() do the CURVENT_SET()/CURVNET_RESTORE() dance
>> for you.
> Duh, I'm getting old. When I looked at sosend(), I didn't spot the 
> CURVNET calls
> in it.
>
>>> When I recently used sosend_generic(), it panic'd without them.
>>>
>> sosend_generic() does not, because usually sosend() calls it, so 
>> it’d
>> already be set.
> Ok, I had thought the
>                 error = so->so_proto->pr_usrreqs->pru_sosend(so, addr, 
> uio,
> 1706	                    top, control, flags, td);
> call in sosend() was calling tcp_usr_send().
>
tcp_usr_send() seems to be called through pru_send, not pru_sosend, so 
sosend_dgram() (or sosend_generic()) is in between there.

> If it is just calling sosend_generic(), then I can just call sosend() 
> for the
> KERN_TLS case. I'll check to see if sosend()  is calling 
> sosend_generic().
>
That’ll presumably depend on what your socket is.

It’s assigned in uipc_domain.c, but it could also be sctp_sosend(), 
sosend_dgram() or pru_sosend_notsupp().


Regards,
Kristof



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C7EDCEEF-99F8-492D-8A6D-766F1E2774F7>