[zeromq-dev] czmq/zbeacon - broadcast address doesn't match selected interface

Shane Hubred shane at hubred.us
Wed Oct 9 17:54:51 CEST 2013

I recently started using zbeacon in 3.2.4 which does not have the
zsys_set_interface function so I added a patch as well. Here's what I
discovered running on Ubuntu:

The 2nd to last line at the end of s_get_interface() cause the chosen
interface to not be chosen (i.e., the broadcast was sent on another

    self->broadcast.sin_addr.s_addr = INADDR_BROADCAST;

Commenting it out made it work (self->broadcast is set above to
interface->ifa_broadaddr) on Ubuntu 12.04. Strangely on Ubuntu 11.10 Server
interface->ifa_broadaddr returns the same thing as interface->ifa_addr even
though the IFF_BROADCAST flag is set in interface->ifa_flags. I put in a
workaround for that using interface->ifa_netmask.

Also, the following line (547 on master) doesn't look right:

                if (streq (interface->ifa_name, zsys_interface ())
                ||  s_wireless_nic (interface->ifa_name))

Looks like it will select the wireless interface if encountered before the
set interface is encountered.

On Wed, Oct 9, 2013 at 10:49 AM, Pieter Hintjens <ph at imatix.com> wrote:

> On Wed, Oct 9, 2013 at 4:49 PM, Jason Ziglar <jasedit at gmail.com> wrote:
> > I'm using zbeacon for service discovery, and have been noticing that the
> beacon doesn't always behave as expected. I'm using the
> zsys_set_interface() call to specify which interface to broadcast over, but
> according to netstat, the beacon is broadcasting over This seems
> to cause the beacon to be routed differently on each machine.
> >
> > Is broadcasting over expected behavior? I've got a patch that
> alters the behavior to what I expect. I'm not sure if I should submit it as
> a pull request or not though.
> Sure, send a pull request. Always welcome.
> -Pieter
> _______________________________________________
> 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/20131009/a100a39e/attachment.htm>

More information about the zeromq-dev mailing list