[olsr-dev] freebsd multiple interfaces

David Cornejo (spam-protected)
Wed Feb 9 09:01:27 CET 2005

I am currently using exactly the method you described of libnet +
recvmsg().  Actually, to keep relatively with the existing structure,
I use recvmsg() as a filter, so I still open a socket for every
interface, but filter out (using recvmsg) packets that weren't
received on the interface the socket was opened on.  It's ugly and
inefficient, but it keeps the basic structure.  Ideally, I can reduce
this to one socket and then demultiplex using recvmsg().

I am however running into some strange problems - if I have a single
interface olsrd works beautifully, but with two I can get the mesh
into a state where one of the interfaces stops receiving traffic
(according to tcpdump and reflected in the lack of messages received
by olsrd).  The configuration has two nodes connected with both
Ethernet and 802.11.  So, I'm not sure I have everything right yet -
I've got some of my network stack guys time this week and I'll try and
figure out what's happening.

dave c
honolulu, hi

On Tue, 08 Feb 2005 11:40:12 +0100, Thomas Lopatic <(spam-protected)> wrote:
> Hi everybody,
> I do not have any objections to moving the packet I/O functions further
> down into the platform-specific directories. Even if we tried to use
> other methods of interface binding on FreeBSD, I think we would end up
> with a lot of code that is specific to FreeBSD. So, we'd end up doing
> this anyway.
> Let me quickly outline, just for the record, what I think an alternative
> method to libnet could look like. I think we should keep this in mind
> for later evaluation.
> Case 1: Multiple interfaces in different subnets, i.e. with different
> directed broadcast addresses, olsrd uses directed broadcasts. I haven't
> tried it, but my guess is that this works right now.
> Case 2: Multiple interfaces in different subnets, olsrd uses
> for broadcasts. We'd still use directed broadcasts, but
> use the IP_ONESBCAST socket option (exists since FreeBSD 4.9) to have
> the OS rewrite the destination address of our directed broadcasts to
> In this way we could send broadcasts
> via a given interface simply by creating directed broadcasts to the
> interface's directed broadcast address. In order to determine the
> incoming interface of a received packet, we've been told to use the
> IP_RECVIF socket option in conjunction with recvmsg(). I haven't looked
> into this, though.
> Case 3: Multiple interfaces in the same subnet. Looks like there
> currently isn't any way to send packets via a given interfaces without
> libnet on FreeBSD, as cases 1 and 2 use the outgoing interface's
> directed broadcast address to specify the interface. Receiving, however,
> should work in the described way (IP_RECVIF, recvmsg()).
> So, I think for now we should use libnet to send packets and recvmsg()
> to receive them, as this is the only way of supporting case 3.
> What do you think?
> -Thomas
> _______________________________________________
> olsr-dev mailing list
> (spam-protected)
> https://www.olsr.org/mailman/listinfo/olsr-dev

More information about the Olsr-dev mailing list