[zeromq-dev] Peer ip address ?

Brandon Carpenter brandon.carpenter at pnnl.gov
Wed Jan 15 23:46:23 CET 2014

I'm new to ZeroMQ, so certainly don't take this as an authoritative answer.

If all you need is to log who is connecting, and possibly deny the 
connection based on IP address, use ZAP with the NULL mechanism. The 
peer IP address is provided as part of the ZAP request.

For routing, it doesn't look like ZeroMQ currently has the ability to 
get the IP address on a per-message basis. However, it doesn't look like 
it would take much to add the ability to grab the IP address using 
zmq_msg_get(). It looks like it would require attaching the name or 
socket reference to the msg_t in zmq::stream_engine_t::in_event() 
(src/stream_engine.cpp) and add code to retrieve it with zmq_msg_get(). 
There's a little more that would be required, but that is where I would 

On 01/15/2014 08:14 AM, mraptor wrote:
> hi I was looking for a way to find the peer/client ip address.
> All of the replies I've seen so far say it is not possible to get the 
> IP address of the peer in ZeroMQ.
> The main objection for not providing the IP address seem to be that 
> zeromq work on top of protocols which may not be TCP/IP.
> The solution pointed by most of the people seems to be to figure out 
> the IP address at the client and pass it as a part of the message.
> I'm currently needing the IP address for logging purposes and in the 
> future for filtering and routing.
> Two problems arise :
> 1. What happens if you don't have access to the client code i.e. it is 
> written by third party
> 2. Second allowing the client to provide the IP address could be major 
> security breach, because if it is up to the client, they can place 
> whatever IP they want, how would you know ?
> How do you solve those problems ?  Unless zeromq, already have some 
> means of getting the peer IP, the discussions about this were from 2011 ?
> thank you
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140115/e5c02351/attachment.htm>

More information about the zeromq-dev mailing list