[olsr-dev] freebsd multiple interfaces

Thomas Lopatic (spam-protected)
Tue Feb 8 11:40:12 CET 2005


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 
255.255.255.255 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 
255.255.255.255. In this way we could send 255.255.255.255 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





More information about the Olsr-dev mailing list