[zeromq-dev] Zyre ipaddress in Hello message

Pieter Hintjens ph at imatix.com
Wed Jan 1 16:01:43 CET 2014


On Sat, Dec 28, 2013 at 11:25 AM, Arnaud Loonstra <arnaud at sphaero.org> wrote:

> Because zbeacon passes the ipaddress on to the agent which the zyre_node
> uses...

Right... HELLO message isn't the beacon, my mistake. The node will
connect using the HELLO's ipaddress only if it didn't already get a
beacon from that node.

You're right that the ipaddress will be wrong in cases with multiple
interfaces. This could be improved... right now the Zyre internals
just don't allow for that. It should pick-up the hostname dynamically
each time it sends HELLO.

Alternatively, as you say, it could get the originating IP address of
each HELLO message. That is more work. The libzmq API doesn't provide
that directly (we could extract it at authentication time, from
ZMQ/4.0 and later).

So option 1 then. The flow is, A gets beacon from B, and then connects
to B and sends HELLO. B receives HELLO from A, and connects back to A.
So A knows what address it received a beacon on.

It seems we need to use recvmsg() instead of recvfrom(). There's an
example here:

http://stackoverflow.com/questions/5281409/get-destination-address-of-a-received-udp-packet

So then, zbeacon would update its hostname property after each recv,
and the caller could use this to construct an accurate HELLO message.

-Pieter



More information about the zeromq-dev mailing list