]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Handle EPROTO errno from recvmsg
authorOndřej Surý <ondrej@isc.org>
Wed, 26 Aug 2020 14:31:13 +0000 (16:31 +0200)
committerOndřej Surý <ondrej@isc.org>
Fri, 28 Aug 2020 18:49:01 +0000 (20:49 +0200)
It was discovered, that some systems might set EPROTO instead of EACCESS
on recvmsg() call causing spurious syslog messages from the socket
code.  This commit returns soft handling of EPROTO errno code to the
socket code. [GL #1928]

(cherry picked from commit e0380d437d044c1f665b1014a0d4bf3972e9c139)

lib/isc/unix/socket.c

index ca84b4bfaeabf6f86cf55d51990923aecfa0b12d..21616251fe2317596ced8d3a1dfe97c59faaf341 100644 (file)
@@ -1528,6 +1528,16 @@ doio_recv(isc__socket_t *sock, isc_socketevent_t *dev) {
                SOFT_OR_HARD(EHOSTUNREACH, ISC_R_HOSTUNREACH);
                SOFT_OR_HARD(EHOSTDOWN, ISC_R_HOSTDOWN);
                SOFT_OR_HARD(ENOBUFS, ISC_R_NORESOURCES);
+               /*
+                * Older operating systems may still return EPROTO in some
+                * situations, for example when receiving ICMP/ICMPv6 errors.
+                * A real life scenario is when ICMPv6 returns code 5 or 6.
+                * These codes are introduced in RFC 4443 from March 2006,
+                * and the document obsoletes RFC 1885. But unfortunately not
+                * all operating systems have caught up with the new standard
+                * (in 2020) and thus a generic protocol error is returned.
+                */
+               SOFT_OR_HARD(EPROTO, ISC_R_HOSTUNREACH);
                /* Should never get this one but it was seen. */
 #ifdef ENOPROTOOPT
                SOFT_OR_HARD(ENOPROTOOPT, ISC_R_HOSTUNREACH);