Project

General

Profile

Actions

Bug #2415

closed

util::dns::Resolver fails on some platforms

Added by Alex Afanasyev about 9 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Category:
Utils
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:

Description

When making DNS resolution query, the current code adds query::all_matching parameter to the query constructor.
With this parameter, the resolver supposed to return all IPv4 and IPv6 matches on a system that does not have a working IPv4 and/or IPv6 address (the default behavior is to return addresses that can potentially work). This addition was made primarily for the sake of unit tests.

At least on FreeBSD and Android platforms it is known that this addition causes DNS resolution failure.

My proposal here is to remove query::all_matching parameter from the query completely. On a working system, the default behavior for the resolution is the correct one. For the test cases we can add a requirement to have both IPv4 and IPv6 configured (there just need to be an interface with non-localhost address). We can also make DNS resolution test cases optional or conditional.

Actions #1

Updated by Alex Afanasyev about 9 years ago

  • Subject changed from util::nds::Resolver fails on some platforms to util::dns::Resolver fails on some platforms
Actions #2

Updated by Junxiao Shi about 9 years ago

I don't understand the issue description.

The hostname to be resolved and the platform configuration can have the following nine combinations:

IPv4-only platform IPv6-only platform IPv4+IPv6 platform
hostname has A record only
hostname has AAAA record only
hostname has A and AAAA records

For each combination, please answer:

  • What's the expected behavior?
  • What's the actual behavior with query::all_matching?
  • What's the actual behavior without query::all_matching?
Actions #3

Updated by Alex Afanasyev about 9 years ago

The documented behavior of query::all_matching

IPv4-only platform IPv6-only platform IPv4+IPv6 platform
hostname has A record only A A A
hostname has AAAA record only AAAA AAAA AAAA
hostname has A and AAAA records A, AAAA A, AAAA A, AAAA

On FreeBSD and Android platform when query::all_matching is specified, the query always fails, no matter what the local configuration is.

The default behavior (as documented):

IPv4-only platform IPv6-only platform IPv4+IPv6 platform
hostname has A record only A - A
hostname has AAAA record only - AAAA AAAA
hostname has A and AAAA records A AAAA A, AAAA
Actions #4

Updated by Davide Pesavento about 9 years ago

Given the tables in note-3, using the default behavior makes sense to me.

Actions #5

Updated by Junxiao Shi about 9 years ago

I agree with dropping query::all_matching. This shall be a change in utils.

Regarding test cases: a global fixture shall detect whether the platform supports IPv4 and IPv6, and write the results into static boolean flags.

A test case that relies on IPv4 or IPv6 shall be written as:

if (!NetworkConfigureDetector::hasIpv4())
  return;

// test with IPv4

NetworkConfigureDetector::hasIpv4() should have BOOST_WARN_MESSAGE("Platform does not support IPv4, skipping test case");, so that this warning isn't repeated in every test case.

Actions #6

Updated by Junxiao Shi about 9 years ago

  • Category changed from Tests to Utils
Actions #7

Updated by Alex Afanasyev about 9 years ago

How are you suggesting to do the network connectivity detection?

Actions #8

Updated by Junxiao Shi about 9 years ago

How are you suggesting to do the network connectivity detection?

Check whether a non-local IPv4/IPv6 address is configured.

Actions #9

Updated by Alex Afanasyev about 9 years ago

That's not a suggestion. That the effect we want to check. How are you expecting us to do this check?

Would using the DNS resolver itself for this be sufficient? In other words, in the fixture we'll try to resolve a host with A and AAAA and depending on which are available enable or disable IPv4 / IPv6.

Actions #10

Updated by Alex Afanasyev about 9 years ago

  • Status changed from New to Code review
  • Assignee set to Alex Afanasyev
  • % Done changed from 0 to 100
Actions #11

Updated by Alex Afanasyev about 9 years ago

  • Status changed from Code review to Closed
Actions

Also available in: Atom PDF