Fwd: Blocking / Holding data from NKE
Fwd: Blocking / Holding data from NKE
- Subject: Fwd: Blocking / Holding data from NKE
- From: Jean Suisse <email@hidden>
- Date: Tue, 28 Aug 2012 23:02:49 +0200
Thank you very much for your help. There are many things I still need to learn and understand, but you have given me a good start. I know where I am heading now.
Jean
On 28 août 2012, at 18:42, Vincent Lubet wrote: Le Aug 28, 2012 à 1:59 AM, Jean Suisse a écrit : You have found a bug in the documentation. In fact when a socket filter sf_connect_out function returns EJUSTRETURN, the error code is converted to 0 (zero) before connect(2) returns to the caller.
So, I guess that from the calling process point of view, the connection attempt was successful. It can feel free to send data. But on the kernel side, nothing is over yet. What happens when the calling process starts sending data on this not-yet completed connection attempt ? Or maybe the process is blocked if it is a sync connection, and no callback occurs (yet) if it is an async request ?
When filtering, if I return EJUSTRETURN. I am then holding on to a handle to the socket itself and to the sockaddr structure. How do I resume the connection process later ? Should I use sock_connect with the socket_t so and struct sockaddr *to that I got from sf_connect_out ?
Yes, exactly.
Yes, you should free the mbufs you have stashed away.
I found 4 functions that can do that: mbuf_free mbuf_freecluster mbuf_freem mbuf_freem_list
Sould I use mbuf_free on each swallowed mbuf or should I call one of the other three on any mbuf I hold ? In the latter case, how do I know which function I should call ?
You should use mbuf_freem because mbufs are complex data structures that often a linked list of mbufs. For a description please see: You cannot close the socket from the kernel but you can disconnect the socket by using the sock_shutdown() KPI function.
Thanks. I found the function in kpi_socket.h.errno_t sock_shutdown(socket_t so, int how);
Is it safe to call it at any time ?
Yes, it is safe
Vincent
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden