]> git.saurik.com Git - apt.git/commitdiff
add new config options "Acquire::ForceIPv4" and
authorMichael Vogt <michael.vogt@ubuntu.com>
Fri, 22 Mar 2013 20:46:53 +0000 (21:46 +0100)
committerMichael Vogt <michael.vogt@ubuntu.com>
Fri, 22 Mar 2013 20:46:53 +0000 (21:46 +0100)
"Acquire::ForceIPv6" to allow focing one or the other
(closes: #611891)

debian/changelog
methods/connect.cc

index a4a0b4c6da8f18f3f6ddb539ae74be695af499cd..4c830afe95e1e3d28cabb3ac260da5bc059c1128 100644 (file)
@@ -15,6 +15,11 @@ apt (0.9.7.8~exp3) UNRELEASEDexperimental; urgency=low
   * methods/connect.cc:
     - provide useful error message in case of EAI_SYSTEM
       (closes: #703603)
+  
+  [ Michael Vogt ]
+  * add new config options "Acquire::ForceIPv4" and 
+    "Acquire::ForceIPv6" to allow focing one or the other
+    (closes: #611891)
 
  -- Michael Vogt <mvo@debian.org>  Sun, 17 Mar 2013 19:46:23 +0100
 
index 3573d3cbf69f60bdbf5da3ff5ae532e58c9376ec..35f4723ce33b2dbb3fac9cb96059107e95eba21c 100644 (file)
@@ -17,6 +17,7 @@
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/acquire-method.h>
+#include <apt-pkg/configuration.h>
 
 #include <stdio.h>
 #include <errno.h>
@@ -167,6 +168,13 @@ bool Connect(std::string Host,int Port,const char *Service,int DefPort,int &Fd,
       Hints.ai_flags = AI_ADDRCONFIG;
       Hints.ai_protocol = 0;
       
+      if(_config->FindB("Acquire::ForceIPv4", false) == true)
+         Hints.ai_family = AF_INET;
+      else if(_config->FindB("Acquire::ForceIPv6", false) == true)
+         Hints.ai_family = AF_INET6;
+      else
+         Hints.ai_family = AF_UNSPEC;
+
       // if we couldn't resolve the host before, we don't try now
       if(bad_addr.find(Host) != bad_addr.end()) 
         return _error->Error(_("Could not resolve '%s'"),Host.c_str());