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

net: cgo lookups do not recheck resolv.conf #10850

Closed
axaxs opened this issue May 14, 2015 · 6 comments

Comments

Projects
None yet
5 participants
@axaxs
Copy link

commented May 14, 2015

Native Go lookups recheck /etc/resolv.conf at minimum every 5 seconds. Cgo lookups should do the same. Currently, you can run into an issue where resolv.conf changes, Go picks it up, but a strange hostname (with \ escapes) is kicked to cgo and fails.

@ianlancetaylor ianlancetaylor added this to the Go1.5Maybe milestone Jun 3, 2015

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jun 3, 2015

I don't know to implement this. Is there a way to tell the libc resolver library to recheck resolv.conf?

@bradfitz

This comment has been minimized.

Copy link
Member

commented Jun 3, 2015

I don't think there's anything to do here.

The whole point of letting libc handle it is to let libc handle it.

But in Go 1.5 we try to handle most lookups in Go, which makes the priority of changing the libc resolver even less important.

(And any backslash escape issue should be handled separately, if it still occurs in Go 1.5)

@axaxs

This comment has been minimized.

Copy link
Author

commented Jun 3, 2015

But Darwin and some other situations will always use C, no? In that case, we are making behavior completely inconsistent across OS. So someone would advertise a product that will continue working in Linux, but fail in OSX when changing networks.
It's just including resolv.h and calling res_init, but would need logic similar to what we did in Go I think. Maybe even combined so that the recheck logic we already have calls res_init? Not sure, I don't do much with C anymore and was never by any means an expert.

@bradfitz

This comment has been minimized.

Copy link
Member

commented Jun 3, 2015

Darwin's libc resolver via lookupd is very good. It will notice files change.

I think this concern is theoretical.

@axaxs

This comment has been minimized.

Copy link
Author

commented Jun 3, 2015

OK, that's good - I'm not a Darwin guy so did not know. So the only inconsistency should be I guess when weird domain names are punted to C. Which is rather rare, but still exists as an inconsistency. But I will concede that it is rather theoretical to happen in reality. I can however reproduce it (by looking up domain with escapes and changing resolv.conf files out).

@rsc

This comment has been minimized.

Copy link
Contributor

commented Jul 15, 2015

I've never seen a C program call res_init to force reloading.
As far as I know, every respectable libc gets this right by itself.

@rsc rsc closed this Jul 15, 2015

@golang golang locked and limited conversation to collaborators Jul 18, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.