diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2010-05-19 02:21:41 +0200 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2010-05-19 02:21:41 +0200 |
commit | ef52da8277d8c3cff8a49999675b8c5f06d3d0c1 (patch) | |
tree | b96f29cc79e76fc15fae8569a82a65fa2af4a8fd | |
parent | e61f7f78159cb6f3267af76ae370a4e21e4ca0c6 (diff) | |
download | fetchmail-ef52da8277d8c3cff8a49999675b8c5f06d3d0c1.tar.gz fetchmail-ef52da8277d8c3cff8a49999675b8c5f06d3d0c1.tar.bz2 fetchmail-ef52da8277d8c3cff8a49999675b8c5f06d3d0c1.zip |
Only report connection failures in verbose mode or if all addresses fail.
-rw-r--r-- | NEWS | 10 | ||||
-rw-r--r-- | socket.c | 25 |
2 files changed, 28 insertions, 7 deletions
@@ -64,6 +64,13 @@ fetchmail-6.3.18 (not yet released): systems as part of libwww on machines where long isn't 32-bits. Fixes Gentoo Bug #319283, reported - including the hint to libwww - by Karl Hakimian. Side effect: fetchmail will now use -lmd on Solaris rather than -lmd5. +* Fetchmail will no longer print connection attempts and errors for one host + in "silent" and "normal" logging modes, unless all connections fail. This + should reduce irritation around refused-connection logging if services are + only on an IPv4 socket if the host also supports IPv6. Often observed as + connections refused to ::1/25 when the subsequent connection to 127.0.0.1/25 + then - silently - succeeds. Fetchmail, unless in verbose mode, will collect + all connect errors and only report them if all of them fail. # KNOWN BUGS AND WORKAROUNDS: (this section floats upwards through the NEWS file so it stays with the @@ -78,6 +85,9 @@ fetchmail-6.3.18 (not yet released): * fetchmail does not track pending deletes over crashes * the command line interface is sometimes a bit stubborn, for instance, fetchmail -s doesn't work with a daemon running +* Linux may return duplicates of an IP address in some circumstances if no or + no global IPv6 addresses are configured. (No workaround. Ubuntu Bug#582585, + Novell Bug#606980.) fetchmail-6.3.17 (released 2010-05-06, 25767 LoC): @@ -264,6 +264,8 @@ int SockOpen(const char *host, const char *service, { struct addrinfo *ai, req; int i, acterr = 0; + int ord; + char errbuf[8192] = ""; #ifdef HAVE_SOCKETPAIR if (plugin) @@ -285,10 +287,13 @@ int SockOpen(const char *host, const char *service, return -1; } + /* NOTE a Linux bug here - getaddrinfo will happily return 127.0.0.1 + * twice if no IPv6 is configured */ i = -1; - for (ai = *ai0; ai; ai = ai->ai_next) { - char buf[80],pb[80]; - int gnie; + for (ord = 0, ai = *ai0; ai; ord++, ai = ai->ai_next) { + char buf[256]; /* hostname */ + char pb[256]; /* service name */ + int gnie; /* getnameinfo result code */ gnie = getnameinfo(ai->ai_addr, ai->ai_addrlen, buf, sizeof(buf), NULL, 0, NI_NUMERICHOST); if (gnie) @@ -299,14 +304,17 @@ int SockOpen(const char *host, const char *service, if (outlevel >= O_VERBOSE) report_build(stdout, GT_("Trying to connect to %s/%s..."), buf, pb); - i = socket(ai->ai_family, ai->ai_socktype, 0); + i = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if (i < 0) { + int e = errno; /* mask EAFNOSUPPORT errors, they confuse users for * multihomed hosts */ if (errno != EAFNOSUPPORT) acterr = errno; if (outlevel >= O_VERBOSE) - report_complete(stdout, GT_("cannot create socket: %s\n"), strerror(errno)); + report_complete(stdout, GT_("cannot create socket: %s\n"), strerror(e)); + snprintf(errbuf+strlen(errbuf), sizeof(errbuf)-strlen(errbuf),\ + GT_("name %d: cannot create socket family %d type %d: %s\n"), ord, ai->ai_family, ai->ai_socktype, strerror(e)); continue; } @@ -323,8 +331,9 @@ int SockOpen(const char *host, const char *service, if (outlevel >= O_VERBOSE) report_complete(stdout, GT_("connection failed.\n")); - if (outlevel > O_SILENT) + if (outlevel >= O_VERBOSE) report(stderr, GT_("connection to %s:%s [%s/%s] failed: %s.\n"), host, service, buf, pb, strerror(e)); + snprintf(errbuf+strlen(errbuf), sizeof(errbuf)-strlen(errbuf), GT_("name %d: connection to %s:%s [%s/%s] failed: %s.\n"), ord, host, service, buf, pb, strerror(e)); fm_close(i); i = -1; continue; @@ -342,8 +351,10 @@ int SockOpen(const char *host, const char *service, fm_freeaddrinfo(*ai0); *ai0 = NULL; - if (i == -1) + if (i == -1) { + report(stderr, GT_("Connection errors for this poll:\n%s"), errbuf); errno = acterr; + } return i; } |