diff --git a/ChangeLog b/ChangeLog
index 1e61769c..febf602b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2010-08-01  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
+
+	Added --enable-async-dns6 option. This option enables IPv6 name
+	resolution in asynchronous DNS resolver. This option will be
+	ignored when --async-dns=false.
+	* doc/aria2c.1.txt
+	* src/AbstractCommand.cc
+	* src/AsyncNameResolver.cc
+	* src/AsyncNameResolver.h
+	* src/DHTEntryPointNameResolveCommand.cc
+	* src/OptionHandlerFactory.cc
+	* src/download_helper.cc
+	* src/prefs.cc
+	* src/prefs.h
+	* src/usage_text.h
+
 2010-07-31  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
 
 	Use hostname of original URI when counting hostname in
diff --git a/doc/aria2c.1 b/doc/aria2c.1
index 766b8c6a..e346453c 100644
--- a/doc/aria2c.1
+++ b/doc/aria2c.1
@@ -2,12 +2,12 @@
 .\"     Title: aria2c
 .\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
 .\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\"      Date: 07/19/2010
+.\"      Date: 08/01/2010
 .\"    Manual: Aria2 Manual
 .\"    Source: Aria2 1.10.0
 .\"  Language: English
 .\"
-.TH "ARIA2C" "1" "07/19/2010" "Aria2 1\&.10\&.0" "Aria2 Manual"
+.TH "ARIA2C" "1" "08/01/2010" "Aria2 1\&.10\&.0" "Aria2 Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -1127,6 +1127,13 @@ Disable IPv6\&. This is useful if you have to use broken DNS and want to avoid t
 \fIfalse\fR
 .RE
 .PP
+\fB\-\-enable\-async\-dns6\fR[=\fItrue\fR|\fIfalse\fR]
+.RS 4
+Enable IPv6 name resolution in asynchronous DNS resolver\&. This option will be ignored when
+\fB\-\-async\-dns\fR=\fIfalse\fR\&. Default:
+\fIfalse\fR
+.RE
+.PP
 \fB\-\-enable\-direct\-io\fR[=\fItrue\fR|\fIfalse\fR]
 .RS 4
 Enable directI/O, which lowers cpu usage while allocating/checking files\&. Turn off if you encounter any error\&. Default:
@@ -2612,6 +2619,17 @@ min\-split\-size
 conditional\-get
 .RE
 .sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+enable\-async\-dns6
+.RE
+.sp
 These options have exactly same meaning of the ones in the command\-line options, but it just applies to the URIs it belongs to\&.
 .sp
 For example, the content of uri\&.txt is
diff --git a/doc/aria2c.1.html b/doc/aria2c.1.html
index 1b2a2534..9ad50db8 100644
--- a/doc/aria2c.1.html
+++ b/doc/aria2c.1.html
@@ -1955,6 +1955,16 @@ writes the piece to the appropriate files.</td>
 </p>
 </dd>
 <dt class="hdlist1">
+<strong>--enable-async-dns6</strong>[=<em>true</em>|<em>false</em>]
+</dt>
+<dd>
+<p>
+  Enable IPv6 name resolution in asynchronous DNS resolver. This
+  option will be ignored when <strong>--async-dns</strong>=<em>false</em>.
+  Default: <em>false</em>
+</p>
+</dd>
+<dt class="hdlist1">
 <strong>--enable-direct-io</strong>[=<em>true</em>|<em>false</em>]
 </dt>
 <dd>
@@ -3003,6 +3013,11 @@ min-split-size
 conditional-get
 </p>
 </li>
+<li>
+<p>
+enable-async-dns6
+</p>
+</li>
 </ul></div>
 <div class="paragraph"><p>These options have exactly same meaning of the ones in the
 command-line options, but it just applies to the URIs it belongs to.</p></div>
@@ -4258,7 +4273,7 @@ files in the program, then also delete it here.</p></div>
 <div id="footnotes"><hr /></div>
 <div id="footer">
 <div id="footer-text">
-Last updated 2010-07-19 13:48:41 JST
+Last updated 2010-08-01 14:56:58 JST
 </div>
 </div>
 </body>
diff --git a/doc/aria2c.1.txt b/doc/aria2c.1.txt
index e0076b22..104a486c 100644
--- a/doc/aria2c.1.txt
+++ b/doc/aria2c.1.txt
@@ -774,6 +774,12 @@ Advanced Options
   Disable IPv6. This is useful if you have to use broken DNS and want
   to avoid terribly slow AAAA record lookup. Default: 'false'
 
+*--enable-async-dns6*[='true'|'false']::
+
+  Enable IPv6 name resolution in asynchronous DNS resolver. This
+  option will be ignored when *--async-dns*='false'.
+  Default: 'false'
+
 *--enable-direct-io*[='true'|'false']::
   Enable directI/O, which lowers cpu usage while allocating/checking files.
   Turn off if you encounter any error.
@@ -1265,6 +1271,7 @@ of URIs. These optional lines must start with white space(s).
 * max-connection-per-server
 * min-split-size
 * conditional-get
+* enable-async-dns6
 
 These options have exactly same meaning of the ones in the
 command-line options, but it just applies to the URIs it belongs to.
diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc
index 54765dca..f8f976f4 100644
--- a/src/AbstractCommand.cc
+++ b/src/AbstractCommand.cc
@@ -638,7 +638,13 @@ bool AbstractCommand::isAsyncNameResolverInitialized() const
 
 void AbstractCommand::initAsyncNameResolver(const std::string& hostname)
 {
-  asyncNameResolver_.reset(new AsyncNameResolver());
+  int family;
+  if(getOption()->getAsBool(PREF_ENABLE_ASYNC_DNS6)) {
+    family = AF_UNSPEC;
+  } else {
+    family = AF_INET;
+  }
+  asyncNameResolver_.reset(new AsyncNameResolver(family));
   if(getLogger()->info()) {
     getLogger()->info(MSG_RESOLVING_HOSTNAME,
                       util::itos(getCuid()).c_str(), hostname.c_str());
diff --git a/src/AsyncNameResolver.cc b/src/AsyncNameResolver.cc
index ae904e7b..bf6a34d1 100644
--- a/src/AsyncNameResolver.cc
+++ b/src/AsyncNameResolver.cc
@@ -53,15 +53,24 @@ void callback(void* arg, int status, int timeouts, struct hostent* host)
     return;
   }
   for(char** ap = host->h_addr_list; *ap; ++ap) {
-    struct in_addr addr;
-    memcpy(&addr, *ap, sizeof(in_addr));
-    resolverPtr->resolvedAddresses_.push_back(inet_ntoa(addr));
+    char addrstring[INET6_ADDRSTRLEN];
+    const char* dst =
+      inet_ntop(host->h_addrtype, *ap, addrstring, sizeof(addrstring));
+    if(dst) {
+      resolverPtr->resolvedAddresses_.push_back(dst);
+    }
+  }
+  if(resolverPtr->resolvedAddresses_.empty()) {
+    resolverPtr->error_ = "inet_ntop failed";
+    resolverPtr->status_ = AsyncNameResolver::STATUS_ERROR;
+  } else {
+    resolverPtr->status_ = AsyncNameResolver::STATUS_SUCCESS;
   }
-  resolverPtr->status_ = AsyncNameResolver::STATUS_SUCCESS;
 }
 
-AsyncNameResolver::AsyncNameResolver():
-  status_(STATUS_READY)
+AsyncNameResolver::AsyncNameResolver(int family):
+  status_(STATUS_READY),
+  family_(family)
 {
   // TODO evaluate return value
   ares_init(&channel_);
@@ -76,7 +85,7 @@ void AsyncNameResolver::resolve(const std::string& name)
 {
   hostname_ = name;
   status_ = STATUS_QUERYING;
-  ares_gethostbyname(channel_, name.c_str(), AF_INET, callback, this);
+  ares_gethostbyname(channel_, name.c_str(), family_, callback, this);
 }
 
 int AsyncNameResolver::getFds(fd_set* rfdsPtr, fd_set* wfdsPtr) const
diff --git a/src/AsyncNameResolver.h b/src/AsyncNameResolver.h
index ad284ec1..ab87d8bb 100644
--- a/src/AsyncNameResolver.h
+++ b/src/AsyncNameResolver.h
@@ -63,13 +63,14 @@ public:
   };
 private:
   STATUS status_;
+  int family_;
   ares_channel channel_;
 
   std::vector<std::string> resolvedAddresses_;
   std::string error_;
   std::string hostname_;
 public:
-  AsyncNameResolver();
+  AsyncNameResolver(int family);
 
   ~AsyncNameResolver();
 
diff --git a/src/DHTEntryPointNameResolveCommand.cc b/src/DHTEntryPointNameResolveCommand.cc
index 5d25f26c..9db92f60 100644
--- a/src/DHTEntryPointNameResolveCommand.cc
+++ b/src/DHTEntryPointNameResolveCommand.cc
@@ -81,7 +81,13 @@ bool DHTEntryPointNameResolveCommand::execute()
   }
 #ifdef ENABLE_ASYNC_DNS
   if(resolver_.isNull()) {
-    resolver_.reset(new AsyncNameResolver());
+    int family;
+    if(e_->getOption()->getAsBool(PREF_ENABLE_ASYNC_DNS6)) {
+      family = AF_UNSPEC;
+    } else {
+      family = AF_INET;
+    }
+    resolver_.reset(new AsyncNameResolver(family));
   }
 #endif // ENABLE_ASYNC_DNS
   try {
diff --git a/src/OptionHandlerFactory.cc b/src/OptionHandlerFactory.cc
index a1df7357..52dafb22 100644
--- a/src/OptionHandlerFactory.cc
+++ b/src/OptionHandlerFactory.cc
@@ -192,6 +192,17 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
     op->hide();
     handlers.push_back(op);
   }
+#ifdef ENABLE_ASYNC_DNS
+  {
+    SharedHandle<OptionHandler> op(new BooleanOptionHandler
+                                   (PREF_ENABLE_ASYNC_DNS6,
+                                    TEXT_ENABLE_ASYNC_DNS6,
+                                    V_FALSE,
+                                    OptionHandler::OPT_ARG));
+    op->addTag(TAG_ADVANCED);
+    handlers.push_back(op);
+  }
+#endif // ENABLE_ASYNC_DNS
 #ifdef ENABLE_DIRECT_IO
   {
     SharedHandle<OptionHandler> op(new BooleanOptionHandler
diff --git a/src/download_helper.cc b/src/download_helper.cc
index 0f85f6db..d7e7494e 100644
--- a/src/download_helper.cc
+++ b/src/download_helper.cc
@@ -162,7 +162,8 @@ const std::set<std::string>& listRequestOptions()
     PREF_HTTP_ACCEPT_GZIP,
     PREF_MAX_CONNECTION_PER_SERVER,
     PREF_MIN_SPLIT_SIZE,
-    PREF_CONDITIONAL_GET
+    PREF_CONDITIONAL_GET,
+    PREF_ENABLE_ASYNC_DNS6
   };
   static std::set<std::string> requestOptions
     (vbegin(REQUEST_OPTIONS), vend(REQUEST_OPTIONS));
diff --git a/src/prefs.cc b/src/prefs.cc
index 61bcc5cb..2712fb48 100644
--- a/src/prefs.cc
+++ b/src/prefs.cc
@@ -198,6 +198,8 @@ const std::string PREF_MIN_SPLIT_SIZE("min-split-size");
 const std::string PREF_CONDITIONAL_GET("conditional-get");
 // value: true | false
 const std::string PREF_SELECT_LEAST_USED_HOST("select-least-used-host");
+// value: true | false
+const std::string PREF_ENABLE_ASYNC_DNS6("enable-async-dns6");
 
 /**
  * FTP related preferences
diff --git a/src/prefs.h b/src/prefs.h
index 7ba05f19..34193d9c 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -202,6 +202,8 @@ extern const std::string PREF_MIN_SPLIT_SIZE;
 extern const std::string PREF_CONDITIONAL_GET;
 // value: true | false
 extern const std::string PREF_SELECT_LEAST_USED_HOST;
+// value: true | false
+extern const std::string PREF_ENABLE_ASYNC_DNS6;
 
 /**
  * FTP related preferences
diff --git a/src/usage_text.h b/src/usage_text.h
index b72910c3..6eb97ee2 100644
--- a/src/usage_text.h
+++ b/src/usage_text.h
@@ -710,3 +710,7 @@
     "                              download completes but before seeding.\n" \
     "                              See --on-download-start option for the\n" \
     "                              requirement of COMMAND.")
+#define TEXT_ENABLE_ASYNC_DNS6                  \
+  _(" --enable-async-dns6[=true|false] Enable IPv6 name resolution in asynchronous\n" \
+    "                              DNS resolver. This option will be ignored when\n" \
+    "                              --async-dns=false.")