site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+7f6Sq9+XJVoq1QPgWFt1gEXR8HYhcJs3OxrAg3gSko=; b=kcH5cUDH3wzbWUqJIl3Y2M4cSN/oXJSSCqsfu0tH4lGCEaFfXTPVWu5WTfchN28/65 RCLXvg9umEc97bpVM5lqALZEJ75ihkgpqrSgORd8CwyutKkxwfL3iIXm4vqROCdW4cy3 LQeJqNm99jSh2mc5EmuFu6uo7QnirxRU3KfyCyT/3BeMOlM2Ie6Xjoeq9xCr3HBe2Fuh z10FzjDUtGadOwjIZpaCeseM2MMBO9Ts9/nC+283aYseV6iEVYtXwbt5lkWNSJPrJ0DO rVJ0dpmwBw1VnC5V3akVdNuuuFWbOfOT/JbGehysw9snTewxbX81WbIctFCx0JRNgJsg XHwA== Finally, the solution is to record the local and remote addresses in sf_notify_fn which will be called in all kinds of state changes (connecting, connected, etc.), then try to block some of them in sf_data_cout and sf_data_in by returning errors. This approach will let the tcp handshake packets pass, but will block the connection later. On Tue, Sep 18, 2018 at 3:47 AM Derek Fawcus < dfawcus+lists-apple-darwin-kernel@employees.org> wrote:
On Fri, Sep 14, 2018 at 02:40:43PM +0800, Haohao Lee wrote:
typedef errno_t (*sf_connect_out_func)(void *cookie, socket_t so, const struct sockaddr *to); Only remote address is provided.
How can I get the local address in sf_connect_out_func or is there another way to achieve this?
I've not checked the darwin source for this, but generally connect seems to do an internal bind first if not already called by the user.
So maybe there will be an initial form of bind callback from where you can stash the source address?
DF _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/darwin-kernel/hayatelee%40gmail.com
This email sent to hayatelee@gmail.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.... This email sent to site_archiver@lists.apple.com