The dynamic Internet gateway plugin

This plugin is meant for real life usage and is not really created for the sake of the example. But since it is a relatively light-weight plugin that performs tasks not related to message flooding, it is included as an example here.

Nodes in a MANET might dynamically obtain and lose Internet connectivity through interfaces not participating in the MANET routing. A typical scenario would be a laptop that might be connected to the Internet through an Ethernet link for a limited time while participating in a MANET through a wireless interface.

A plugin that dynamically updates the HNA information announced by the local node has been implemented. This plugin checks if the local node has an Internet-connection and updates the local HNA set based on this. This implementation is a good example of using plugins for other tasks than packet transmission. Combining this plugin with an automatic network cable detection daemon, such as NetPlug[50], would be a good idea. Only IPv4 is supported as of now.

The main object of this plugin is to poll for an Internet route and add or remove such a route from the local HNA set if a change is detected. An Internet-connection is identified by a default gateway with a hop-count of 0. This means that a route to 0.0.0.0/0 with metric 0 is considered an Internet route. Since olsrd sets a hop-count/metric bigger than 0 on all routes, this plugin will not react to Internet gateways added by olsrd.

To poll for route updates, a function that searches the kernel routing table for a default gateway is registered with the olsrd scheduler to be executed regularly on a given interval. If a new Internet route with metric 0 is discovered, the plugin will add this entry to the local HNA set by calling the function:

void
add_local_hna4_entry(union olsr_ip_addr *net, union hna_netmask *mask)

This function has been fetched from olsrd through the plugin interface.

Whenever such a registered Internet route is removed from the kernel routing table the local HNA entry is also removed using the function:

void
remove_local_hna4_entry(union olsr_ip_addr *net, union hna_netmask *mask)

This enables nodes to act as Internet gateways whenever they have Internet connectivity not set up by olsrd.

The dynamic Internet gateway plugin offers IPC to read debug output. Just like with the power-status plugin, all communication is outbound, but since clients should be able to connect at any time, the IPC server socket is registered with the socket parser of olsrd. The IPC socket listens on TCP port 9999, and only allows connections from the local host(127.0.0.1). A user can telnet to port 9999 at 127.0.0.1 to read the debug info.

Andreas 2004-07-29