Re: Chaining socket filters
Re: Chaining socket filters
- Subject: Re: Chaining socket filters
- From: "Quinn \"The Eskimo!\"" <email@hidden>
- Date: Thu, 20 Sep 2018 07:58:49 +0100
On 19 Sep 2018, at 21:31, Prokash Sinha <email@hidden> wrote:
> So there are two returns to indicate, if the kernel continue thru the chain
> or not.
It’s based on the function result:
* 0 sends the request down the chain
* `EJUSTRETURN` prevents the request going down the chain but doesn’t signal an
error to the caller
* any other error prevents the request going down the chain and signals that
error to the caller
You can see this in action in Darwin. For example, consider your `sf_data_out`
function. It’s called by `sflt_data_out`, which iterates through the filters
call the `sf_data_out` on each filter. That returns if it gets any error. The
caller, `sosend`, specifically looks for `EJUSTRETURN` and… well… just returns
<https://opensource.apple.com/source/xnu/xnu-4570.1.46/bsd/kern/kpi_socketfilter.c>
<https://opensource.apple.com/source/xnu/xnu-4570.1.46/bsd/kern/uipc_socket.c>
ps You might want to post your socket filter questions to the MacNetworkProg
mailing list. While I’m happy to answer them here, that list has other members
with direct experience with this stuff.
<https://lists.apple.com/mailman/listinfo/macnetworkprog>
Share and Enjoy
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden