---
name: "ieee80211_free_node"
section: "9"
platform: "linux"
package: "freebsd-manpages"
version: "6.0-5"
release: "Debian 4.0 (Etch)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/ieee80211_free_node"
---

# ieee80211\_free\_node(9)

software 802.11 stack node management functions

## NAME

**ieee80211\_node\_attach**, **ieee80211\_node\_lateattach**, **ieee80211\_node\_detach**, **ieee80211\_begin\_scan**, **ieee80211\_next\_scan**, **ieee80211\_create\_ibss**, **ieee80211\_end\_scan**, **ieee80211\_alloc\_node**, **ieee80211\_dup\_bss**, **ieee80211\_find\_node**, **ieee80211\_lookup\_node**, **ieee80211\_free\_node**, **ieee80211\_free\_allnodes**, **ieee80211\_timeout\_nodes**, **ieee80211\_iterate\_nodes** – software 802.11 stack node management functions

## SYNOPSIS

**#include \<net80211/ieee80211\_var.h\>**

**#include \<net80211/ieee80211\_proto.h\>**

**#include \<net80211/ieee80211\_node.h\>**

*void*\

**ieee80211\_node\_attach**(*struct ifnet \*ifp*);

*void*\

**ieee80211\_node\_lateattach**(*struct ifnet \*ifp*);

*void*\

**ieee80211\_node\_detach**(*struct ifnet \*ifp*);

*void*\

**ieee80211\_begin\_scan**(*struct ifnet \*ifp*);

*void*\

**ieee80211\_next\_scan**(*struct ifnet \*ifp*);

*void*\

**ieee80211\_create\_ibss**(*struct ieee80211com \*ic*, *struct ieee80211\_channel \*chan*);

*void*\

**ieee80211\_end\_scan**(*struct ifnet \*ifp*);

*struct* *ieee80211\_node* *\**\

**ieee80211\_alloc\_node**(*struct ieee80211com \*ic*, *u\_int8\_t \*macaddr*);

*struct* *ieee80211\_node* *\**\

**ieee80211\_dup\_bss**(*struct ieee80211com \*ic*, *u\_int8\_t \*macaddr*);

*struct* *ieee80211\_node* *\**\

**ieee80211\_find\_node**(*struct ieee80211com \*ic*, *u\_int8\_t \*macaddr*);

*struct* *ieee80211\_node* *\**\

**ieee80211\_lookup\_node**(*struct ieee80211com \*ic*, *u\_int8\_t \*macaddr*, *struct ieee80211\_channel \*chan*);

*void*\

**ieee80211\_free\_node**(*struct ieee80211com \*ic*, *struct ieee80211\_node \*ni*);

*void*\

**ieee80211\_free\_allnodes**(*struct ieee80211com \*ic*);

*void*\

**ieee80211\_timeout\_nodes**(*struct ieee80211com \*ic*);

*void*\

**ieee80211\_iterate\_nodes**(*struct ieee80211com \*ic*, *ieee80211\_iter\_func \*f*, *void \*arg*);

## DESCRIPTION

These functions are used to manage node lists within the software 802.11 stack. These lists are typically used for implementing host-mode AP functionality, or providing signal quality information about neighbouring nodes.

The **ieee80211\_node\_attach**() function is called from [ieee80211\_ifattach(9)](/ieee80211_ifattach/9.md) to initialize node database management callbacks for the interface *ifp* (specifically for memory allocation, node copying and node signal inspection). These functions may be overridden in special circumstances, as long as this is done after calling [ieee80211\_ifattach(9)](/ieee80211_ifattach/9.md) and prior to any other call which may allocate a node.

The **ieee80211\_node\_lateattach**() function initialises the *ic\_bss* node element of the interface *ifp* during [ieee80211\_media\_init(9)](/ieee80211_media_init/9.md). This late attachment is to account for certain special cases described under **ieee80211\_node\_attach**().

The **ieee80211\_node\_detach**() function destroys all node database state associated with the interface *ifp*, and is usually called during device detach.

The **ieee80211\_begin\_scan**() function initialises the node database in preparation of an active scan for an access point on the interface *ifp*. The scan begins on the next radio channel by calling **ieee80211\_next\_scan**() internally. The actual scanning for an access point is not automated; the device driver itself only handles setting the radio frequency of the card and stepping through the channels.

The **ieee80211\_next\_scan**() function is used to inform the [ieee80211(9)](/ieee80211/9.md) layer that the interface *ifp* is now scanning for an access point on the next radio channel. A device driver is expected to first call **ieee80211\_begin\_scan**(), to initialize the node database, then set the radio channel on the device; then, after a certain time has elapsed (200ms for example), call **ieee80211\_next\_scan**() to move to the next channel. Typically, a callout is used to automate this process; see [callout\_init(9)](/callout_init/9.md) for more information on how to use callouts.

The **ieee80211\_create\_ibss**() function sets up the net80211-specific portion of an interface's softc, *ic*, for use in IBSS mode.

The **ieee80211\_end\_scan**() function is called by **ieee80211\_next\_scan**() when the state machine has peformed a full cycle of scanning on all available radio channels. Internally, **ieee80211\_end\_scan**() will inspect the node cache associated with the interface *ifp* for suitable access points found during scanning, and associate with one, should the parameters of the node match those of the configuration requested from userland.

The **ieee80211\_alloc\_node**() function allocates an instance of *struct ieee80211\_node* for a node having the MAC address *macaddr*, and associates it with the interface *ic*. If the allocation is successful, the node structure is initialised by **ieee80211\_setup\_node**(); otherwise, NULL is returned.

The **ieee80211\_dup\_bss**() function is similar to **ieee80211\_alloc\_node**(), but is instead used to create a node database entry for the BSSID *macaddr* associated with the interface *ic*. If the allocation is successful, the node structure is initialised by **ieee80211\_setup\_node**(); otherwise, NULL is returned.

The **ieee80211\_find\_node**() function will iterate through the node list associated with the interface *ic*, searching for a node entry which matches *macaddr*. If the entry is found, its reference count is incremented, and a pointer to the node is returned; otherwise, NULL will be returned.

The **ieee80211\_lookup\_node**() function is similar to **ieee80211\_find\_node**(), with an additional argument *chan* which is used to specify a channel for the match. If the entry is found, its reference count is incremented, and a pointer to the node is returned; otherwise, NULL will be returned.

The **ieee80211\_free\_node**() function will remove the node *ni* from the node database entries associated with the interface *ic*, and free any memory associated with the node. This private method can be overridden in **ieee80211\_node\_attach**().

The **ieee80211\_free\_allnodes**() function will iterate through the node list calling **ieee80211\_free\_node**() for all nodes associated with the interface *ic*.

The **ieee80211\_timeout\_nodes**() checks if the inactivity timer of each node associated with the interface *ic* has exceeded the pre-defined constant IEEE80211\_INACT\_MAX. If so, then the node is freed, after sending a deauthentication message.

The **ieee80211\_iterate\_nodes**() function will call the user-defined callback function *f* for all nodes in the node database associated with the interface *ic*. The callback is invoked with the with the user-supplied value *arg* and a pointer to the current node.

## SEE ALSO

[ieee80211(9)](/ieee80211/9.md), [ifnet(9)](/ifnet/9.md)

## HISTORY

The **ieee80211** series of functions first appeared in NetBSD 1.5, and were later ported to FreeBSD 4.6.

## AUTHORS

This manual page was written by Bruce M. Simpson ⟨bms@FreeBSD.org⟩ and Darron Broad ⟨darron@kewl.org⟩.
