mirror of https://github.com/aria2/aria2
Disable AI_ADDRCONFIG if no IPv4/IPv6 address is configured for any interface
parent
4df7b540a2
commit
295affe160
|
@ -219,14 +219,18 @@ Context::Context(bool standalone, int argc, char** argv, const KeyVals& options)
|
|||
|
||||
if (op->getAsBool(PREF_DISABLE_IPV6)) {
|
||||
SocketCore::setProtocolFamily(AF_INET);
|
||||
// Get rid of AI_ADDRCONFIG. It causes name resolution error
|
||||
// when none of network interface has IPv4 address.
|
||||
setDefaultAIFlags(0);
|
||||
}
|
||||
SocketCore::setIpDscp(op->getAsInt(PREF_DSCP));
|
||||
SocketCore::setSocketRecvBufferSize(
|
||||
op->getAsInt(PREF_SOCKET_RECV_BUFFER_SIZE));
|
||||
net::checkAddrconfig();
|
||||
|
||||
if (!net::getIPv4AddrConfigured() && !net::getIPv6AddrConfigured()) {
|
||||
// Get rid of AI_ADDRCONFIG. It causes name resolution error when
|
||||
// none of network interface has IPv4/v6 address.
|
||||
setDefaultAIFlags(0);
|
||||
}
|
||||
|
||||
// Bind interface
|
||||
if (!op->get(PREF_INTERFACE).empty()) {
|
||||
std::string iface = op->get(PREF_INTERFACE);
|
||||
|
|
Loading…
Reference in New Issue