zeromq / libzmq

ZeroMQ core engine in C++, implements ZMTP/3.1
https://www.zeromq.org
Mozilla Public License 2.0
9.53k stars 2.34k forks source link

Fallback to hostname resolution in TCP and UDP. #4561

Closed guill-delacourt closed 1 year ago

guill-delacourt commented 1 year ago

This PR fixes the needs behind the issue #4514 by enabling fallback to hostname resolution if interface resolution fails.

When resolving addresses, there is already a fallback to getaddrinfo when interface resolution fails. When allow_dns is set to false, the AI_NUMERICHOST flag is added to getaddrinfo to disable hostname resolution. The fact we are binding is currently used to disable hostname resolution in TCP and UDP. To enable the fallback to hostname resolution, the allow_dns option should be set to true in all cases.