Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: dd9e5e7d4bbd
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 26005d0c06e7
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Jan 29, 2018

  1. Do not leak DNS Request IDs

    While d1a760e fixed handling of compressed IPv6 addresses,
    it also broke the "freeing" part of it.
    
    Currently every DNS request leaks single request id:
    ```
    require 'resolv'
    
    Resolv::DNS::RequestID.values.map(&:length)
    
    Resolv::DNS.new.getaddress('example.com')
    
    Resolv::DNS::RequestID.values.map(&:length)
    ```
    
    Given the fact that request ids are chosen from `0x0000..0xffff` range - the app can issue 65535 requests and then will be blocked forever trying to allocate another one.
    
    This commit makes request id caching work by using same data for allocation and freeing.
    fxposter authored and olleolleolle committed Jan 29, 2018
    3
    Copy the full SHA
    ada05fa View commit details
  2. Merge pull request #5019 from olleolleolle/carry-do-not-leak-dns-requ…

    …est-ids-to-jruby-9-1
    
    Do not leak DNS Request IDs
    enebo authored Jan 29, 2018
    Copy the full SHA
    26005d0 View commit details
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/ruby/stdlib/resolv.rb
2 changes: 1 addition & 1 deletion lib/ruby/stdlib/resolv.rb
Original file line number Diff line number Diff line change
@@ -776,7 +776,7 @@ def sender(msg, data, host, port=Port)
sock = @socks_hash[host.index(':') ? "::" : "0.0.0.0"]
return nil if !sock
service = [IPAddr.new(host), port]
id = DNS.allocate_request_id(host, port)
id = DNS.allocate_request_id(service[0], service[1])
request = msg.encode
request[0,2] = [id].pack('n')
return @senders[[service, id]] =