
What is the correct way to negate the (default) resolver flag, address_configured? On Windows, at least, specifying address_configured (which translates to AI_ADDRCONFIG) has a nasty side effect. If the 'external' network is down, the resolver can no longer resolve the "localhost" address. More here http://src.chromium.org/viewvc/chrome/trunk/src/net/base/host_resolver.cc?r1=16212&r2=16211 address_configured is the default flag for ip::basic_resolver_query so I need to specify a flag that turns it off. In the underlying addrinfo struct this would just mean specifying 0 as the flag but that isn't an option with ASIO as far as I can tell. How would I do this? Thanks! Alex -- Easy SFTP for Windows Explorer (http://www.swish-sftp.org)

What is the correct way to negate the (default) resolver flag, address_configured?
On Windows, at least, specifying address_configured (which translates to AI_ADDRCONFIG) has a nasty side effect. If the 'external' network is down, the resolver can no longer resolve the "localhost" address. More here http://src.chromium.org/viewvc/chrome/trunk/src/net/base/host_resolver.cc?r1=16212&r2=16211
Well, I know nothing about this flag, but in asio sources we find the following: # if defined(AI_ADDRCONFIG) && !defined(__QNXNTO__) address_configured = AI_ADDRCONFIG # else address_configured = 0 # endif So can you just #define AI_ADDRCONFIG 0 ?

On Fri, 4 Mar 2011 13:37:38 +0200, Igor R wrote:
What is the correct way to negate the (default) resolver flag, address_configured?
Well, I know nothing about this flag, but in asio sources we find the following:
# if defined(AI_ADDRCONFIG) && !defined(__QNXNTO__) address_configured = AI_ADDRCONFIG # else address_configured = 0 # endif
So can you just #define AI_ADDRCONFIG 0 ?
I could do but it would be a horrible hack! :o AI_ADDRCONFIG has a perfectly valid meaning - just not a meaning I wish to invoke. Redeffing it to do something else strikes me as a bad idea. Alex -- Easy SFTP for Windows Explorer (http://www.swish-sftp.org)

On 4.3.2011 11:48, Alexander Lamaison wrote:
What is the correct way to negate the (default) resolver flag, address_configured?
On Windows, at least, specifying address_configured (which translates to AI_ADDRCONFIG) has a nasty side effect. If the 'external' network is down, the resolver can no longer resolve the "localhost" address. More here http://src.chromium.org/viewvc/chrome/trunk/src/net/base/host_resolver.cc?r1=16212&r2=16211
address_configured is the default flag for ip::basic_resolver_query so I need to specify a flag that turns it off. In the underlying addrinfo struct this would just mean specifying 0 as the flag but that isn't an option with ASIO as far as I can tell. How would I do this?
I ran into this problem, and came up with the following workaround: boost::asio::ip::tcp::resolver::query query( hostname, port, boost::asio::ip::tcp::resolver::query::all_matching ); HTH

On Fri, 04 Mar 2011 14:30:36 +0100, Juraj Ivančić wrote:
On 4.3.2011 11:48, Alexander Lamaison wrote:
What is the correct way to negate the (default) resolver flag, address_configured?
On Windows, at least, specifying address_configured (which translates to AI_ADDRCONFIG) has a nasty side effect. If the 'external' network is down, the resolver can no longer resolve the "localhost" address. More here http://src.chromium.org/viewvc/chrome/trunk/src/net/base/host_resolver.cc?r1=16212&r2=16211
address_configured is the default flag for ip::basic_resolver_query so I need to specify a flag that turns it off. In the underlying addrinfo struct this would just mean specifying 0 as the flag but that isn't an option with ASIO as far as I can tell. How would I do this?
I ran into this problem, and came up with the following workaround:
boost::asio::ip::tcp::resolver::query query( hostname, port, boost::asio::ip::tcp::resolver::query::all_matching );
Doesn't all_matching have it's own meaning? In other words, doesn't getaddrinfo behave differently when given 0 as its flags rather than AI_ALL? MSDN says "If the AI_ALL bit is set, a request is made for IPv6 addresses and IPv4 addressses with AI_V4MAPPED." which is as clear as mud to me. Thanks. Alex -- Easy SFTP for Windows Explorer (http://www.swish-sftp.org)

On 4.3.2011 14:52, Alexander Lamaison wrote:
On Fri, 04 Mar 2011 14:30:36 +0100, Juraj Ivančić wrote:
On 4.3.2011 11:48, Alexander Lamaison wrote:
What is the correct way to negate the (default) resolver flag, address_configured?
On Windows, at least, specifying address_configured (which translates to AI_ADDRCONFIG) has a nasty side effect. If the 'external' network is down, the resolver can no longer resolve the "localhost" address. More here http://src.chromium.org/viewvc/chrome/trunk/src/net/base/host_resolver.cc?r1=16212&r2=16211
address_configured is the default flag for ip::basic_resolver_query so I need to specify a flag that turns it off. In the underlying addrinfo struct this would just mean specifying 0 as the flag but that isn't an option with ASIO as far as I can tell. How would I do this?
I ran into this problem, and came up with the following workaround:
boost::asio::ip::tcp::resolver::query query( hostname, port, boost::asio::ip::tcp::resolver::query::all_matching );
Doesn't all_matching have it's own meaning? In other words, doesn't getaddrinfo behave differently when given 0 as its flags rather than AI_ALL?
MSDN says "If the AI_ALL bit is set, a request is made for IPv6 addresses and IPv4 addressses with AI_V4MAPPED." which is as clear as mud to me.
Not 100% sure anymore, but I think that I just wanted to avoid AI_ADDRCONFIG flag for the same reason as you, and this did the trick. Of course, if you prefer, you can always pass 0 statically cast to boost::asio::ip::tcp::resolver::query::flags.

On Sun, 06 Mar 2011 00:15:46 +0100, Juraj Ivančić wrote:
On 4.3.2011 14:52, Alexander Lamaison wrote:
On Fri, 04 Mar 2011 14:30:36 +0100, Juraj Ivančić wrote:
On 4.3.2011 11:48, Alexander Lamaison wrote:
What is the correct way to negate the (default) resolver flag, address_configured?
On Windows, at least, specifying address_configured (which translates to AI_ADDRCONFIG) has a nasty side effect. If the 'external' network is down, the resolver can no longer resolve the "localhost" address. More here http://src.chromium.org/viewvc/chrome/trunk/src/net/base/host_resolver.cc?r1=16212&r2=16211
address_configured is the default flag for ip::basic_resolver_query so I need to specify a flag that turns it off. In the underlying addrinfo struct this would just mean specifying 0 as the flag but that isn't an option with ASIO as far as I can tell. How would I do this?
I ran into this problem, and came up with the following workaround:
boost::asio::ip::tcp::resolver::query query( hostname, port, boost::asio::ip::tcp::resolver::query::all_matching );
Doesn't all_matching have it's own meaning? In other words, doesn't getaddrinfo behave differently when given 0 as its flags rather than AI_ALL?
Not 100% sure anymore, but I think that I just wanted to avoid AI_ADDRCONFIG flag for the same reason as you, and this did the trick. Of course, if you prefer, you can always pass 0 statically cast to boost::asio::ip::tcp::resolver::query::flags.
As all_matching has worked for you, I'll stick with that for the moment. Thanks for the advice :) Alex -- Easy SFTP for Windows Explorer (http://www.swish-sftp.org)
participants (3)
-
Alexander Lamaison
-
Igor R
-
Juraj Ivančić