Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Use ipaddr to compare the sender's address #4496
When resolving names using compressed IPv6-only DNS servers, it could
This patch encapsulates the from address and the address of the sender in
This fixes #3663.
When resolving names using compressed IPv6-only DNS servers, it could happen that when processing the response of a name query, the IP of the sender is not compressed so using a simple string comparison is not safe. This patch encapsulates the from address and the address of the sender in IPAddr objects so the comparison is safe and just works in all cases. This fixes #3663.
This looks fine to me, and we'll probably merge it, but I have a few concerns.
We normally try to avoid patching the standard library if we can help it. Especially like this, where a new dependency is being introduced. But perhaps MRI has this problem too when running in an IPv6 environment?
I don't have any IPv6 setup right now. Any chance you can try to reproduce with MRI?
Thanks for looking at the patch.
I could not reproduce the problem with MRI, see this comment. But anyway:
# grep nameserver /etc/resolv.conf nameserver 2001:1458:201:1100::5 nameserver 2001:1458:201:1100::5 # ruby -v ruby 2.0.0p648 (2015-12-16) [x86_64-linux] # time ruby -e "require 'resolv'; puts Resolv.getaddress 'web.cern.ch'" 126.96.36.199 real 0m0.083s user 0m0.061s sys 0m0.021s
Same machine, same environment, but on top of jRuby:
I'm happy to perform other tests with MRI, just let me know :)
Do you see feasible to backport the patch to 1.7? That'd be awesome!
@headius I think if we can open up a new issue to figure out why we are different and close the issue around this PR we can land it. Then it will work as a workaround until we dig deeper. I would rather we release sooner than later...and hey it will not be our first modification to stdlib files :|
I would like to close the original report so we can display this is now working in the release in our notes (but we can link to it)