mirror of https://github.com/aria2/aria2
2009-12-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added --disable-ipv6 option to disable IPv6. * doc/aria2c.1.txt * src/InitiateConnectionCommand.cc * src/NameResolver.cc * src/NameResolver.h * src/OptionHandlerFactory.cc * src/main.cc * src/prefs.cc * src/prefs.h * src/usage_text.hpull/1/head
parent
a7709947f2
commit
4100ba77c3
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
||||||
|
2009-12-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Added --disable-ipv6 option to disable IPv6.
|
||||||
|
* doc/aria2c.1.txt
|
||||||
|
* src/InitiateConnectionCommand.cc
|
||||||
|
* src/NameResolver.cc
|
||||||
|
* src/NameResolver.h
|
||||||
|
* src/OptionHandlerFactory.cc
|
||||||
|
* src/main.cc
|
||||||
|
* src/prefs.cc
|
||||||
|
* src/prefs.h
|
||||||
|
* src/usage_text.h
|
||||||
|
|
||||||
2009-12-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2009-12-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Updated usage text for --bt-prioritize-piece option.
|
Updated usage text for --bt-prioritize-piece option.
|
||||||
|
|
|
@ -881,6 +881,12 @@ and standard input, standard output and standard error will be redirected to
|
||||||
\fIfalse\fR
|
\fIfalse\fR
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.PP
|
||||||
|
\fB\-\-disable\-ipv6\fR[=\fItrue\fR|\fIfalse\fR]
|
||||||
|
.RS 4
|
||||||
|
Disable IPv6\&. This is useful if you have to use broken DNS and want to avoid terribly slow AAAA record lookup\&. Default:
|
||||||
|
\fIfalse\fR
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
\fB\-\-enable\-direct\-io\fR[=\fItrue\fR|\fIfalse\fR]
|
\fB\-\-enable\-direct\-io\fR[=\fItrue\fR|\fIfalse\fR]
|
||||||
.RS 4
|
.RS 4
|
||||||
Enable directI/O, which lowers cpu usage while allocating/checking files\&. Turn off if you encounter any error\&. Default:
|
Enable directI/O, which lowers cpu usage while allocating/checking files\&. Turn off if you encounter any error\&. Default:
|
||||||
|
@ -937,7 +943,7 @@ Bind sockets to given interface\&. You can specify interface name, IP address an
|
||||||
.ps -1
|
.ps -1
|
||||||
.br
|
.br
|
||||||
.sp
|
.sp
|
||||||
If an interface has multiple addresses, it is highly recommended to specify IP address explicitly\&.
|
If an interface has multiple addresses, it is highly recommended to specify IP address explicitly\&. See also \fB\-\-disable\-ipv6\fR\&.
|
||||||
.sp .5v
|
.sp .5v
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -1685,6 +1685,15 @@ writes the piece to the appropriate files.</td>
|
||||||
</p>
|
</p>
|
||||||
</dd>
|
</dd>
|
||||||
<dt class="hdlist1">
|
<dt class="hdlist1">
|
||||||
|
<strong>--disable-ipv6</strong>[=<em>true</em>|<em>false</em>]
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
<p>
|
||||||
|
Disable IPv6. This is useful if you have to use broken DNS and want
|
||||||
|
to avoid terribly slow AAAA record lookup. Default: <em>false</em>
|
||||||
|
</p>
|
||||||
|
</dd>
|
||||||
|
<dt class="hdlist1">
|
||||||
<strong>--enable-direct-io</strong>[=<em>true</em>|<em>false</em>]
|
<strong>--enable-direct-io</strong>[=<em>true</em>|<em>false</em>]
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
|
@ -1744,7 +1753,7 @@ writes the piece to the appropriate files.</td>
|
||||||
<div class="title">Note</div>
|
<div class="title">Note</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="content">If an interface has multiple addresses, it is highly recommended to specify
|
<td class="content">If an interface has multiple addresses, it is highly recommended to specify
|
||||||
IP address explicitly.</td>
|
IP address explicitly. See also <strong>--disable-ipv6</strong>.</td>
|
||||||
</tr></table>
|
</tr></table>
|
||||||
</div>
|
</div>
|
||||||
<div class="dlist"><dl>
|
<div class="dlist"><dl>
|
||||||
|
@ -3448,7 +3457,7 @@ files in the program, then also delete it here.</p></div>
|
||||||
<div id="footnotes"><hr /></div>
|
<div id="footnotes"><hr /></div>
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
<div id="footer-text">
|
<div id="footer-text">
|
||||||
Last updated 2009-12-05 15:42:10 JST
|
Last updated 2009-12-05 16:08:32 JST
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -608,6 +608,11 @@ Advanced Options
|
||||||
and standard input, standard output and standard error will be
|
and standard input, standard output and standard error will be
|
||||||
redirected to '/dev/null'. Default: 'false'
|
redirected to '/dev/null'. Default: 'false'
|
||||||
|
|
||||||
|
*--disable-ipv6*[='true'|'false']::
|
||||||
|
|
||||||
|
Disable IPv6. This is useful if you have to use broken DNS and want
|
||||||
|
to avoid terribly slow AAAA record lookup. Default: 'false'
|
||||||
|
|
||||||
*--enable-direct-io*[='true'|'false']::
|
*--enable-direct-io*[='true'|'false']::
|
||||||
Enable directI/O, which lowers cpu usage while allocating/checking files.
|
Enable directI/O, which lowers cpu usage while allocating/checking files.
|
||||||
Turn off if you encounter any error.
|
Turn off if you encounter any error.
|
||||||
|
@ -645,7 +650,7 @@ Advanced Options
|
||||||
|
|
||||||
[NOTE]
|
[NOTE]
|
||||||
If an interface has multiple addresses, it is highly recommended to specify
|
If an interface has multiple addresses, it is highly recommended to specify
|
||||||
IP address explicitly.
|
IP address explicitly. See also *--disable-ipv6*.
|
||||||
|
|
||||||
*--log-level*=LEVEL::
|
*--log-level*=LEVEL::
|
||||||
Set log level to output.
|
Set log level to output.
|
||||||
|
|
|
@ -98,6 +98,9 @@ bool InitiateConnectionCommand::executeInternal() {
|
||||||
{
|
{
|
||||||
NameResolver res;
|
NameResolver res;
|
||||||
res.setSocktype(SOCK_STREAM);
|
res.setSocktype(SOCK_STREAM);
|
||||||
|
if(e->option->getAsBool(PREF_DISABLE_IPV6)) {
|
||||||
|
res.setFamily(AF_INET);
|
||||||
|
}
|
||||||
res.resolve(addrs, hostname);
|
res.resolve(addrs, hostname);
|
||||||
}
|
}
|
||||||
logger->info(MSG_NAME_RESOLUTION_COMPLETE, cuid,
|
logger->info(MSG_NAME_RESOLUTION_COMPLETE, cuid,
|
||||||
|
|
|
@ -33,15 +33,17 @@
|
||||||
*/
|
*/
|
||||||
/* copyright --> */
|
/* copyright --> */
|
||||||
#include "NameResolver.h"
|
#include "NameResolver.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#include "DlAbortEx.h"
|
#include "DlAbortEx.h"
|
||||||
#include "message.h"
|
#include "message.h"
|
||||||
#include "StringFormat.h"
|
#include "StringFormat.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
NameResolver::NameResolver():_socktype(0) {}
|
NameResolver::NameResolver():_socktype(0), _family(AF_UNSPEC) {}
|
||||||
|
|
||||||
void NameResolver::resolve(std::deque<std::string>& resolvedAddresses,
|
void NameResolver::resolve(std::deque<std::string>& resolvedAddresses,
|
||||||
const std::string& hostname)
|
const std::string& hostname)
|
||||||
|
@ -49,7 +51,7 @@ void NameResolver::resolve(std::deque<std::string>& resolvedAddresses,
|
||||||
struct addrinfo hints;
|
struct addrinfo hints;
|
||||||
struct addrinfo* res;
|
struct addrinfo* res;
|
||||||
memset(&hints, 0, sizeof(hints));
|
memset(&hints, 0, sizeof(hints));
|
||||||
hints.ai_family = AF_UNSPEC;
|
hints.ai_family = _family;
|
||||||
hints.ai_socktype = _socktype;
|
hints.ai_socktype = _socktype;
|
||||||
hints.ai_flags = 0;
|
hints.ai_flags = 0;
|
||||||
hints.ai_protocol = 0;
|
hints.ai_protocol = 0;
|
||||||
|
|
|
@ -44,6 +44,7 @@ namespace aria2 {
|
||||||
class NameResolver {
|
class NameResolver {
|
||||||
private:
|
private:
|
||||||
int _socktype;
|
int _socktype;
|
||||||
|
int _family;
|
||||||
public:
|
public:
|
||||||
NameResolver();
|
NameResolver();
|
||||||
|
|
||||||
|
@ -55,6 +56,12 @@ public:
|
||||||
|
|
||||||
// specify SOCK_STREAM or SOCK_DGRAM
|
// specify SOCK_STREAM or SOCK_DGRAM
|
||||||
void setSocktype(int socktype);
|
void setSocktype(int socktype);
|
||||||
|
|
||||||
|
// specify protocol family
|
||||||
|
void setFamily(int family)
|
||||||
|
{
|
||||||
|
_family = family;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
|
@ -153,6 +153,15 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
|
||||||
op->addTag(TAG_FILE);
|
op->addTag(TAG_FILE);
|
||||||
handlers.push_back(op);
|
handlers.push_back(op);
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
SharedHandle<OptionHandler> op(new BooleanOptionHandler
|
||||||
|
(PREF_DISABLE_IPV6,
|
||||||
|
TEXT_DISABLE_IPV6,
|
||||||
|
V_FALSE,
|
||||||
|
OptionHandler::OPT_ARG));
|
||||||
|
op->addTag(TAG_ADVANCED);
|
||||||
|
handlers.push_back(op);
|
||||||
|
}
|
||||||
{
|
{
|
||||||
SharedHandle<NumberOptionHandler> op(new NumberOptionHandler
|
SharedHandle<NumberOptionHandler> op(new NumberOptionHandler
|
||||||
(PREF_DNS_TIMEOUT,
|
(PREF_DNS_TIMEOUT,
|
||||||
|
|
|
@ -208,6 +208,9 @@ downloadresultcode::RESULT main(int argc, char* argv[])
|
||||||
MessageDigestHelper::staticSHA1DigestInit();
|
MessageDigestHelper::staticSHA1DigestInit();
|
||||||
#endif // ENABLE_MESSAGE_DIGEST
|
#endif // ENABLE_MESSAGE_DIGEST
|
||||||
|
|
||||||
|
if(op->getAsBool(PREF_DISABLE_IPV6)) {
|
||||||
|
SocketCore::setProtocolFamily(AF_INET);
|
||||||
|
}
|
||||||
// Bind interface
|
// Bind interface
|
||||||
if(!op->get(PREF_INTERFACE).empty()) {
|
if(!op->get(PREF_INTERFACE).empty()) {
|
||||||
std::string interface = op->get(PREF_INTERFACE);
|
std::string interface = op->get(PREF_INTERFACE);
|
||||||
|
|
|
@ -174,6 +174,8 @@ const std::string PREF_ON_DOWNLOAD_ERROR("on-download-error");
|
||||||
const std::string PREF_XML_RPC_LISTEN_ALL("xml-rpc-listen-all");
|
const std::string PREF_XML_RPC_LISTEN_ALL("xml-rpc-listen-all");
|
||||||
// value: string
|
// value: string
|
||||||
const std::string PREF_INTERFACE("interface");
|
const std::string PREF_INTERFACE("interface");
|
||||||
|
// value: true | false
|
||||||
|
const std::string PREF_DISABLE_IPV6("disable-ipv6");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FTP related preferences
|
* FTP related preferences
|
||||||
|
|
|
@ -178,6 +178,8 @@ extern const std::string PREF_ON_DOWNLOAD_ERROR;
|
||||||
extern const std::string PREF_XML_RPC_LISTEN_ALL;
|
extern const std::string PREF_XML_RPC_LISTEN_ALL;
|
||||||
// value: string
|
// value: string
|
||||||
extern const std::string PREF_INTERFACE;
|
extern const std::string PREF_INTERFACE;
|
||||||
|
// value: true | false
|
||||||
|
extern const std::string PREF_DISABLE_IPV6;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FTP related preferences
|
* FTP related preferences
|
||||||
|
|
|
@ -579,3 +579,5 @@ _(" --bt-prioritize-piece=head[=SIZE],tail[=SIZE] Try to download first and last
|
||||||
#define TEXT_INTERFACE \
|
#define TEXT_INTERFACE \
|
||||||
_(" --interface=INTERFACE Bind sockets to given interface. You can specify\n"\
|
_(" --interface=INTERFACE Bind sockets to given interface. You can specify\n"\
|
||||||
" interface name, IP address and hostname.")
|
" interface name, IP address and hostname.")
|
||||||
|
#define TEXT_DISABLE_IPV6 \
|
||||||
|
_(" --disable-ipv6[=true|false] Disable IPv6.")
|
||||||
|
|
Loading…
Reference in New Issue