From 945d2a8aeecf844137843265e72d7991f77c3353 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 21 Mar 2013 16:18:58 +0100 Subject: merge patch from Colin to fix error message from getaddrinfo() (#703603) --- methods/connect.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'methods/connect.cc') diff --git a/methods/connect.cc b/methods/connect.cc index 9a092a43c..3573d3cbf 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -197,6 +197,9 @@ bool Connect(std::string Host,int Port,const char *Service,int DefPort,int &Fd, return _error->Error(_("Temporary failure resolving '%s'"), Host.c_str()); } + if (Res == EAI_SYSTEM) + return _error->Error(_("System error resolving '%s:%s' (%s)"), + Host.c_str(),ServStr,strerror(errno)); return _error->Error(_("Something wicked happened resolving '%s:%s' (%i - %s)"), Host.c_str(),ServStr,Res,gai_strerror(Res)); } -- cgit v1.2.3-70-g09d2 From 45d02095cbd425c741b69810f91bc2282bf9230b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 22 Mar 2013 21:46:53 +0100 Subject: add new config options "Acquire::ForceIPv4" and "Acquire::ForceIPv6" to allow focing one or the other (closes: #611891) --- debian/changelog | 5 +++++ methods/connect.cc | 8 ++++++++ 2 files changed, 13 insertions(+) (limited to 'methods/connect.cc') diff --git a/debian/changelog b/debian/changelog index a4a0b4c6d..4c830afe9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Sun, 17 Mar 2013 19:46:23 +0100 diff --git a/methods/connect.cc b/methods/connect.cc index 3573d3cbf..35f4723ce 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -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()); -- cgit v1.2.3-70-g09d2 From 5cf466f44ef3eeefbdabc95e1b369bad8889f899 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 25 Mar 2013 09:03:48 +0100 Subject: * methods/connect.cc: - use Errno() instead of strerror(), thanks to David Kalnischk --- debian/changelog | 4 ++++ methods/connect.cc | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'methods/connect.cc') diff --git a/debian/changelog b/debian/changelog index 558b657ce..840fd697c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,10 @@ apt (0.9.7.9~exp2) UNRELEASED; urgency=low - fix test now that #1098752 is fixed * po/{ca,cs,ru}.po: - fix merge artifact + + [ Michael Vogt ] + * methods/connect.cc: + - use Errno() instead of strerror(), thanks to David Kalnischk -- Christian Perrier Sun, 24 Mar 2013 08:57:45 +0100 diff --git a/methods/connect.cc b/methods/connect.cc index 35f4723ce..fc7a72ee9 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -206,8 +206,8 @@ bool Connect(std::string Host,int Port,const char *Service,int DefPort,int &Fd, Host.c_str()); } if (Res == EAI_SYSTEM) - return _error->Error(_("System error resolving '%s:%s' (%s)"), - Host.c_str(),ServStr,strerror(errno)); + return _error->Errno("getaddrinfo", _("System error resolving '%s:%s'"), + Host.c_str(),ServStr); return _error->Error(_("Something wicked happened resolving '%s:%s' (%i - %s)"), Host.c_str(),ServStr,Res,gai_strerror(Res)); } -- cgit v1.2.3-70-g09d2