Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netxlite: consider bypassing net.Resolver completely #2118

Open
bassosimone opened this issue May 28, 2022 · 0 comments
Open

netxlite: consider bypassing net.Resolver completely #2118

bassosimone opened this issue May 28, 2022 · 0 comments
Assignees
Labels
bug Something isn't working enhancement improving existing code or new feature ooni/probe-engine platform/android priority/medium user feedback requests that have been added to the backlog as a direct result of user feedback or testing

Comments

@bassosimone
Copy link
Contributor

This issue is about bypassing net.Resolver in internal/netxlite when compiled with CGO_ENABLED=0 (which is what one would get when cross compiling the code). The ooni/probe-cli#764 pull request is changing netxlite to bypass net.Resolver with CGO_ENABLED=1 in favor of calling getaddrinfo directly to fix #2029. This means that we will always have a working resolver when compiled with CGO_ENABLED=1. What's more, we'll have the luxury of using the system resolver, which reportedly is the only reliable resolver in some very filtered networks (e.g., during partial shutdowns). OTOH, with CGO_ENABLED=0, we are still using net.Resolver in its netgo flavor, which means reading /etc/resolv.conf. Because there is no /etc/resolv.conf on Android, miniooni cross compiled for Android does not work in this scenario (this is already the case regardless of our changes to improve getaddrinfo). My proposal here is to fallback to an UDP resolver in this case rather than relying on using the one written by the Go time and included in the stdlib. Such a resolver would probably attempt to use /etc/resolv.conf along with a set of hardcoded resolvers (e.g., 8.8.8.8:53/udp) trying to provide CGO_ENABLED=0 users with a workable resolver. I'm flagging this issue as a user request because we received reports of miniooni not working on Android using Termux in Slack.

@bassosimone bassosimone added bug Something isn't working enhancement improving existing code or new feature priority/medium user feedback requests that have been added to the backlog as a direct result of user feedback or testing platform/android ooni/probe-engine labels May 28, 2022
@bassosimone bassosimone self-assigned this May 28, 2022
bassosimone added a commit to ooni/probe-cli that referenced this issue May 28, 2022
This commit changes our system resolver to call getaddrinfo directly when CGO is enabled. This change allows us to:

1. obtain the CNAME easily

2. obtain the real getaddrinfo retval

3. handle platform specific oddities such as `EAI_NODATA`
returned on Android devices

See ooni/probe#2029 and ooni/probe#2029 (comment) in particular.

See ooni/probe#2033 for documentation regarding the desire to see `getaddrinfo`'s retval.

See ooni/probe#2118 for possible follow-up changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement improving existing code or new feature ooni/probe-engine platform/android priority/medium user feedback requests that have been added to the backlog as a direct result of user feedback or testing
Projects
Status: No status
Development

No branches or pull requests

1 participant