"Acquire::ForceIPv6" to allow focing one or the other
(closes: #611891)
* methods/connect.cc:
- provide useful error message in case of EAI_SYSTEM
(closes: #703603)
* 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
-- Michael Vogt <mvo@debian.org> Sun, 17 Mar 2013 19:46:23 +0100
#include <apt-pkg/fileutl.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/acquire-method.h>
#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>
#include <stdio.h>
#include <errno.h>
Hints.ai_flags = AI_ADDRCONFIG;
Hints.ai_protocol = 0;
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());
// 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());