Olsrd needs to fetch information about the network interfaces
it is set up to use. This mainly includes fetching the unicast
and broadcast IP addresses
used by the network interface. To fetch such information
various ioctl calls are made. They are documented in the
netdevice(7) manual page. If using IPv6, some considerations have to
be taken, this is discussed later.
Most interface configuration in olsrd is done in the
src/interface.c file.
The ioctl commands are defined in various header-files, the most
interesting commands regarding network interfaces, can be located in
sys/ioctl.h6.1. Here various ways to get and set network
interface data is listed.
Looking in the net/if.h header-file the data-structure
needed for transmitting data, using the network interface
related ioctl requests, can be found. The ifreq struct is
the most used data-structure in network interface related ioctls.
Network interfaces are only set up for use with olsrd if certain
criteria is met. The interface has to have the UP flag
set, it has to be configured with and IP
address and a broadcast address and it cannot a be special device
such as the loopback interface.