From: jschneiderhan@...
Date: 2016-10-14T14:58:56+00:00
Subject: [ruby-core:77631] [Ruby trunk Bug#12838] Duplication of UDP packets for DNS responses causing "no address" results for valid hostnames

Issue #12838 has been updated by Jon-Erik Schneiderhan.

File check-sender.diff added

I added a diff file (check-sender.diff) instead of using the issue description to show the change I made to fix the error on my machine. The change and diff were made against the v2_3_1 tag in the git repo mirrored on github. I'm not necessarily suggesting it as the fix for the issue, just mentioning it as something interesting that I noticed.

----------------------------------------
Bug #12838: Duplication of UDP packets for DNS responses causing "no address" results for valid hostnames
https://bugs.ruby-lang.org/issues/12838#change-60900

* Author: Jon-Erik Schneiderhan
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin14]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
A network that I'm running a Ruby app on has an issue where it is duplicating UDP packets (a separate issue that I need to fix). This is resulting in intermittent "not found" results for valid hostnames.

In my case, my resolver is setup to use multiple search domains, say bad1.com, bad2.com, and good.com. A lookup for hostname 'example' will perform lookups on example.bad1.com, example.bad2.com, example.good.com, and then finally plain 'example'. Say example.good.com is a valid hostname with a corresponding record. What I am seeing is that the duplication of the response s for the first two DNS queries are being read as the response for example.good.com, and I am getting a "no address for example.good.com" error message. Note that this is only happening every once in awhile, when the responses are duplicated.

I have been able to reproduce with the attached server.rb and client.rb files. I also noticed that if I changed the following line to:

https://github.com/ruby/ruby/blob/5827d8e887d881eb3a6e6ea7410590261c90545f/lib/resolv.rb#L709
if (s = sender_for(from, msg)) && s == sender

then my problems went away. I have to admit though, I don't really understand the entirely of that file. Not from lack of effort.

You should be able to reproduce the error by running server.rb and client.rb. You may need to use sudo for server.rb in order to bind to port 53 (or you can modify the files to use a higher port).

---Files--------------------------------
server.rb (2.17 KB)
client.rb (239 Bytes)
check-sender.diff (429 Bytes)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>