summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-08-02 15:36:32 +0900
committerSven Eden <sven.eden@prydeworx.com>2018-10-29 10:18:25 +0100
commitd07ba72570dd5624913701fecf3244e1fa5c1438 (patch)
tree16698fc3c020994ab7bf13db4ae510ed9da70b26
parent4b5652fb033e51fe8194b11054f54a603086824e (diff)
resolve: treat some icmp errors as disconnected
Fixes #9773. (cherry picked from commit 68c597e9e4bb36ade966d9df54dfaa9f956230e9)
-rw-r--r--src/basic/fd-util.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
index 2e5616cb7..b2d5b11a9 100644
--- a/src/basic/fd-util.h
+++ b/src/basic/fd-util.h
@@ -84,8 +84,12 @@ int fd_duplicate_data_fd(int fd);
#endif // 0
/* Hint: ENETUNREACH happens if we try to connect to "non-existing" special IP addresses, such as ::5 */
-#define ERRNO_IS_DISCONNECT(r) \
- IN_SET(r, ENOTCONN, ECONNRESET, ECONNREFUSED, ECONNABORTED, EPIPE, ENETUNREACH)
+/* The kernel sends e.g., EHOSTUNREACH or ENONET to userspace in some ICMP error cases.
+ * See the icmp_err_convert[] in net/ipv4/icmp.c in the kernel sources */
+#define ERRNO_IS_DISCONNECT(r) \
+ IN_SET(r, \
+ ENOTCONN, ECONNRESET, ECONNREFUSED, ECONNABORTED, EPIPE, \
+ ENETUNREACH, EHOSTUNREACH, ENOPROTOOPT, EHOSTDOWN, ENONET)
/* Resource exhaustion, could be our fault or general system trouble */
#define ERRNO_IS_RESOURCE(r) \