Lunatik

netlink.nl80211.interfaceModule

Wireless interface management.

An nl80211 object over the "nl80211" generic netlink family: create an instance with netlink.nl80211.interface() then list, add and delete wireless interfaces; the underlying socket is closed by close() (or the to-be-closed __close). All methods block and require a sleepable runtime.

See also

Class interface

interface:__call ([pid]) Opens a session, calling the class: netlink.nl80211.interface([pid]).
interface:add (opts) Adds a virtual interface to a wiphy.
interface:del (opts) Deletes a virtual interface.
interface:list ([opts]) Lists the wireless interfaces known to the kernel.
interface:new ([o]) Wraps a table in the class, or derives a class from it.

Class interface in detail

interface:__call ([pid])
Opens a session, calling the class: netlink.nl80211.interface([pid]).

Parameters

  • pid integer a task whose network namespace the object reaches, which holds the wiphys and interfaces nl80211 answers for; the initial network namespace when absent. (optional)

Returns

    interface a new interface object; nil and "ESRCH" if no task has that pid, or the task has exited.

Raises

EOPNOTSUPP on a kernel whose sockets cannot hold a namespace of their own, or ENOENT when the nl80211 family is not registered.

See also

interface:add (opts)
Adds a virtual interface to a wiphy.

Parameters

Returns

    integer the new interface’s ifindex.

Raises

on a netlink error (e.g. the name is taken or the iftype unsupported).
interface:del (opts)
Deletes a virtual interface.

Parameters

  • opts table interface parameters: ifindex.

Raises

on a netlink error.
interface:list ([opts])
Lists the wireless interfaces known to the kernel.

Parameters

  • opts table list options, of which an interface takes none. (optional)

Returns

    table list of {ifindex, name, wiphy, iftype, mac} tables (mac is 6 raw bytes).
interface:new ([o])
Wraps a table in the class, or derives a class from it. It opens no socket: calling the class does, netlink.nl80211.interface().

Parameters

  • o table an initial object table. (optional)

Returns

    interface the wrapped table or the derived class.

See also