Link layer notification

Link layer notifications can be used for a variety of interesting functionality in ad-hoc networks, but here they will be considered only for setting some lower threshold for accepting data traffic. The goal is to make sure links are relatively robust before processing traffic received on these links. In addition, link layer information could be used in the hysteresis calculation to calculate link quality.

The WLAN drivers in GNU/Linux implement a ``spy'' functionality where one can register MAC addresses of nodes for which the driver should collect link quality statistics. The user tool iwspy can be used to add spy nodes and view link statistics. The source of iwspy was the first place to look when the work on link layer information was started. The ability to retrieve and maintain link quality information from the drivers is implemented in olsrd in a limited fashion. Communicating with the WLAN driver is done using ioctl commands located in include/linux/wireless.h. The ioctl commands SIOCGIWSPY, and SIOCSIWSPY are used for fetching and adding spy nodes. Luckily, this registration of traffic quality works in ad-hoc peer-to-peer mode as well as in the managed mode used when connecting to access points. The downside is that the drivers by default, only implement support for up to eight simultaneous spy addresses.

As mentioned, spy entries are registered on MAC addresses. To get a hold of the MAC address of a neighbor the ARP[55] cache is queried. This is done using the SIOCGARP ioctl. Unfortunately, MAC addresses are not cached until traffic to the IP address of the remote host is initiated. Therefore, if the local node is to find the MAC address of its neighbor A, it would first query the ARP cache. If no traffic has been unicasted to A from the local node, no ARP cache entry would be located. In that case the local node needs to trigger an ARP WHOHAS query by unicasting some traffic to A. In olsrd the MAC lookup is done this way. If no MAC address is mapped to the IP address in the ARP cache, then some traffic to that IP is initiated. This is done by sending a single ICMP PING message to the IP address. A thread is spawned to build and send the message, this thread exits as soon as the packet is sent. Upon the next ARP cache query, the MAC address will be allocated if the IP address was reachable. The process is illustrated in figure 7.3.

Figure: The IW spy registration based on an IP address.

A function that polls for updates in the quality values of the registered neighbors is registered with the scheduler to be executed at a low interval. As of yet, the quality values are only stored and displayed to the user, meaning that no real action is taken based on the values.

The values returned by the iwspy ioctl are contained in a struct defined in include/linux/wireless.h:

struct	iw_quality
	__u8		qual;		/* link quality (%retries, SNR,
					   %missed beacons or better...) */
	__u8		level;		/* signal level (dBm) */
	__u8		noise;		/* noise level (dBm) */
	__u8		updated;	/* Flags to know if updated */

The link layer notification source is located in src/linux/link_layer.c.

Andreas 2004-07-29