Project

General

Profile

Actions

Bug #16439

closed

Resolv::DNS: timeouts if multiple IPv6 name servers are given and address contains leading zero

Added by jmr (Jan-Martin Rämer) over 4 years ago. Updated almost 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:96374]
Tags:

Description

Hi,

Resolv::DNS does not return any results under those conditions:

  • there are at least two name servers (in /etc/resolv.conf).
  • The name servers have IPv6 addresses containing leading zeros.

Example resolv.conf:
nameserver 2001:0db8::0001:1
nameserver 2001:0db8::0002:1

This is caused by a mismatch in representation of the address: Requester::sender_for compares the address of the answering server (e.g. 2001:0db8::1:1) with the address the request was sent to (e.g. 2001:0db8::0001:1).
This can be fixed by stripping leading zeros from the sender's address, as done in the attached patch.

Best regards,
Jan-Martin


Files

resolv.rb.patch (397 Bytes) resolv.rb.patch jmr (Jan-Martin Rämer), 12/20/2019 01:00 PM

Updated by jeremyevans0 (Jeremy Evans) almost 4 years ago

This isn't just a problem for IPv6, it happens for IPv4 as well (e.g. 127.0.0.01). It will happen in any case where the input is not in canonical form, where canonical form is the form that Addrinfo#ip_address gives you. I've added a pull request to fix this: https://github.com/ruby/ruby/pull/3161

Actions #2

Updated by jeremyevans (Jeremy Evans) almost 4 years ago

  • Status changed from Open to Closed

Applied in changeset git|04b5203a031d372b725e407519f10da6deda0e78.


Convert ip addresses to canonical form in Resolv::DNS::Requester::UnconnectedUDP#sender

Otherwise, if the IP address given is not in canonical form, it
won't match, and Resolv will ignore it.

Fixes [Bug #16439]

Actions

Also available in: Atom PDF

Like0
Like0Like0