Skip to content

Use IP_RECVERR / IPV6_RECVERR to learn about ICMP destination unreachable

BIND 9 uses a connect()ed UDP socket when sending recursive queries. The connect()ed socket provides feedback on a variety of ICMP errors (e.g. port unreachable) which BIND 9 can then use to decide what to do with errors (report them to the client, try again with a different nameserver etc).

However, Linux's implementation does not report what it considers "transient" conditions, which is defined as Destination Host Unreachable, Destination Network Unreachable, Source Route Failed and Message Too Big.

BIND 9 now uses set setsockopt(fd, SOL_IP(V6), IP(V6)_RECVERR, &one, sizeof(one)); and receive a EPOLL_ERR, and recvmsg return value so that it notices that the send has failed immediately rather than waiting for a timeout.

Closes #835 (closed)

Merge request reports