zeromq / libzmq

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

Add an option to select how address names are interpreted in zmq_bind #4514

Closed guill-delacourt closed 1 year ago

guill-delacourt commented 1 year ago

Issue description

We have a use-case in which we would like to put a domain name in the address given to zmq_bind. However, currently, domain names are only allowed in addresses of zmq_connect. An address name in zmq_bind is interpreted as a network interface name.

Could there be an option to select how names are interpreted in zmq_bind ?

In our use-case, the IP address to use is not known in advance and using a wildcard is not possible due to security concerns. The domain name is the only element we know in advance that would allow us to bind the socket.

Environment

Minimal test code / Steps to reproduce the issue

  1. Use a domain name in the endpoint of a binding socket (using TCP or UDP protocols).

What's the actual result? (include assertion message & call stack if applicable)

The address name is interpreted as a network interface name, and zmq_bind fails as there is no network interface with the name given.

What's the expected result?

The addess name is correctly interpreted as a domain name and zmq_bind binds to the correct address.

bluca commented 1 year ago

https://github.com/zeromq/libzmq/pull/4561