Unexpected (?) behavior in socket filter (sf_connect_out)
Unexpected (?) behavior in socket filter (sf_connect_out)
- Subject: Unexpected (?) behavior in socket filter (sf_connect_out)
- From: Jean Suisse <email@hidden>
- Date: Thu, 27 Sep 2012 23:19:06 +0200
Hello,
I have been fighting for weeks now to make a socket filter work properly. And during some testings I have come across a strange behavior.
1. In the connect_out function of a socket filter, if I deny a connection request by returning an error (ENETDOWN for instance), the calling user app gets the error (safari is the test app) – fine.
2. If I first delay the request by returning EJUSTRETURN and resume it later by calling sock_connect, the connect_out filter function is called again. This is expected, and since I want to resume the connection, I now return 0. The connection is established and from the user app point of view the connection just took longer to establish – still fine.
3. The issue arises when I want to deny the connection after delaying it. I follow the same pattern as in (2) except that I return ENETDOWN when connect_out is called for the second time instead of returning 0. The expected result is the same as in (1). However, in this case, the error does not propagate to the app. And the user app still appears to be waiting for the connection to be established.
I find this behavior strange. Is this expected ? There might be a logic behind it, but I can't figure it out. I would have expected (3) to give the same result as (1). Is there a way to achieve the expected result ?
Best Regards, Jean
|
_______________________________________________
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