ares_conn: use sock_funcs.agetsockname() instead of getsockname()#895
Merged
bradh352 merged 1 commit intoc-ares:mainfrom Oct 9, 2024
Merged
ares_conn: use sock_funcs.agetsockname() instead of getsockname()#895bradh352 merged 1 commit intoc-ares:mainfrom
bradh352 merged 1 commit intoc-ares:mainfrom
Conversation
this change addresses an issue with DNS cookie invalidation for users of the legacy API and custom network stacks (e.g., Seastar's DNS). in 0274543, we added an optional `agetsockname` to `ares_socket_functions_ex` struct, and intended to skip calling this function in DNS cookie invalidation if this function is not available for legacy API users. but we are still calling this system call directly, this fails Seastar's DNS which uses c-ares to resolve names, and it uses the socket function table to override the network stack to use its own userspace TCP/IP stack, in that case, the fd passed to c-ares is not a valid file descriptor, hence the call fails. in this change, we - replace direct getsockname() call with sock_funcs.agetsockname() - skip the call if agetsockname() is not configured Refs 0274543 Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
Contributor
Author
|
@bradh352 hi Brad, could you please help review this change? i tested the main HEAD with Seastar, the dns tests failed with the same error. but after applying this change, the tests exercising seastar's dns subsystem passed. |
Contributor
Author
|
see also the discussion at #893 (comment) |
Member
|
ugh, I apparently committed the changes to ares_conn.c in a different branch I was working on. Sorry about that. I'll go ahead and accept this PR as mine did basically the same thing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
this change addresses an issue with DNS cookie invalidation for users of the legacy API and custom network stacks (e.g., Seastar's DNS).
in 0274543, we added an optional
agetsocknametoares_socket_functions_exstruct, and intended to skip calling this function in DNS cookie invalidation if this function is not available for legacy API users.but we are still calling this system call directly, this fails Seastar's DNS which uses c-ares to resolve names, and it uses the socket function table to override the network stack to use its own userspace TCP/IP stack, in that case, the fd passed to c-ares is not a valid file descriptor, hence the call fails.
in this change, we
Refs 0274543