This is a follow up for commit 33fb966197f1 ("Remove sender/message_id
pair after response received in resolv", 2020-09-11).
As the @senders instance variable is also used for tracking transaction
ID allocation, simply removing an entry without releasing the ID would
eventually deplete the ID space and cause
Resolv::DNS.allocate_request_id to hang.
It seems the intention of the code was to check that the received DNS
message is actually the response for the question made within the method
earlier. Let's have it actually do so.
[Bug #12838] https://bugs.ruby-lang.org/issues/12838
[Bug #17748] https://bugs.ruby-lang.org/issues/17748https://github.com/ruby/resolv/commit/53ca9c9209
Now that it should work correctly, test that every address returned
by Socket.ip_address_list is resolvable.
Socket works with IPv6 link local addresses, and ipaddr now does
as well, so I think resolv should support them.
Fixes [Bug #17112]
Once a response for a given DNS request has been received (which
requires a matching message id), the [sender, message_id] pair
should be removed from the list of valid senders. This makes it
so duplicate responses from the same sender are ignored.
Fixes [Bug #12838]
This removes the related tests, and puts the related specs behind
version guards. This affects all code in lib, including some
libraries that may want to support older versions of Ruby.
* lib/resolv.rb (UnconnectedUDP#lazy_initialize): store new
sockets before binding, so the sockets get closed when the
requester is closing.
* lib/resolv.rb (ConnectedUDP#lazy_initialize): ditto.
* lib/resolv.rb (UnconnectedUDP#close): synchronize to get rid of
race condition.
* lib/resolv.rb (ConnectedUDP#close): ditto.
[ruby-core:85901] [Bug #14571]
From: quixoten (Devin Christensen) <quixoten@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/resolv.rb (Resolv::Hosts::DefaultFileName): fallback to NUL
device when Win32::Resolv.get_hosts_path() returned nil, to get
rid of TypeError in lazy_initialize.
[ruby-core:84907] [Bug #14369] [Fix GH-1791]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/resolv.rb (each_address): use safe navigation operator to
avoid extra hash lookups, as well as each_name since r56890.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/resolv.rb (Resolv::DNS::Message::MessageDecoder): treat the
data as a byte buffer.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/resolv.rb (Resolv::DNS::Message::MessageDecoder#get_rr):
re-raise an exception from decode_rdata as DecodeError, so it
can report them to the top in more informative way. It was not
reflecting on errors of data and thus breaking. Client code
expects `DecodeError` and knows how to handle broken messages.
[Fix GH-1511]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
@addr2name is a private Hash and never changes its default_proc,
so only pay the hash lookup cost once; we know missing entries
in the hash will be nil.
* lib/resolv.rb (each_name): use safe navigation operator
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This reduces both human code and bytecode.
lib/resolv.rb (sender_for, Config.parse_resolv_conf): use symbol proc
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/resolv.rb (Resolv::LOC::Coord.create): fixed.
[ruby-core:72567] [Bug #11912] fixed by Eric Wong and Kazuhiro
NISHIYAMA.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/resolv.rb (Resolv::DNS#extract_resources): Use each_resource
instead of each_answer.
[ruby-core:75461] [Bug#12372] reported by Rafael Fernandez Lopez.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Prevent overflow of pointer to labels.
Patch by Hannes Georg. [ruby-core:71248] [Bug #11632]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
The monotonic clock is preferred as it is guaranteed to be
continuous and not subject to jumps due to adjustments.
* lib/net/resolv.rb (request): use monotonic clock
* lib/net/http.rb (begin_transport, end_transport): ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
In case a process encounters high-numbered FDs, this allows
consistent performance on systems with ppoll support.
[ruby-core:35572]
* ext/socket/lib/socket.rb (connect_nonblock): use IO#wait_writable
* lib/drb/drb.rb (DRB::DRbTCPSocket#alive?): use IO#wait_readable
* lib/webrick/httpserver.rb (run): ditto
* lib/resolv.rb (request): ditto for single socket case
[ruby-core:68943] [Feature #11081]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/resolv.rb (Resolv::DNS::Resource#==, #hash): elements
returned by Kernel#instance_variables are Symbols now.
[ruby-core:68128] [Bug #10857]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This allows "gem install /path/to/local.gem" to be successful
on a machine without a network connection.
[ruby-core:67411] [Bug #10712]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
ASCII-8BIT before downcase. case insensivity of DNS labels doesn't
apply non-ASCII characters. [RFC 4343]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/resolv.rb (Resolv::DNS::Name#==): DNS is case-insensitive, so the
comparison should be case-insensitive as well.
[ruby-core:66498] [Bug #10550]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/resolv.rb (Resolv::DNS::Name): names with different dots
should be different.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Thanks Vit Ondruch for the patch! [ruby-core:65836]
* test/resolv/test_dns.rb: test for patch
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
security.mac.portacl.port_high is changed.
See mac_portacl(4) for details.
Reported by Jakub Szafranski. [ruby-core:60917] [Bug #9544]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
DecodeError if no data before the limit.
Reported by Will Bryant. [ruby-core:60557] [Bug #9498]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e