Wireless Netlink

The nl80211 module provides functions for interacting with the nl80211 netlink interface for wireless networking configuration and management.

Functions can be individually imported and directly accessed using the named import syntax:

import { error, request, listener, waitfor, const } from 'nl80211';

// Send a nl80211 request
let response = request(const.NL80211_CMD_GET_WIPHY, 0, { wiphy: 0 });

// Create a listener for wireless events
let wifiListener = listener((msg) => {
    print('Received wireless event:', msg, '\n');
}, [const.NL80211_CMD_NEW_INTERFACE, const.NL80211_CMD_DEL_INTERFACE]);

// Wait for a specific nl80211 event
let event = waitfor([const.NL80211_CMD_NEW_SCAN_RESULTS], 5000);
if (event)
    print('Received scan results:', event.msg, '\n');

Alternatively, the module namespace can be imported using a wildcard import statement:

import * as nl80211 from 'nl80211';

// Send a nl80211 request
let response = nl80211.request(nl80211.const.NL80211_CMD_GET_WIPHY, 0, { wiphy: 0 });

// Create a listener for wireless events
let listener = nl80211.listener((msg) => {
    print('Received wireless event:', msg, '\n');
}, [nl80211.const.NL80211_CMD_NEW_INTERFACE, nl80211.const.NL80211_CMD_DEL_INTERFACE]);

Additionally, the nl80211 module namespace may also be imported by invoking the ucode interpreter with the -lnl80211 switch.

Classes

nl80211.listener

Represents a netlink listener resource.

Type Definitions

HWSIM commands

Properties
NameTypeDescription
HWSIM_CMD_REGISTERnumber

Register radio

HWSIM_CMD_FRAMEnumber

Send frame

HWSIM_CMD_TX_INFO_FRAMEnumber

Send TX info frame

HWSIM_CMD_NEW_RADIOnumber

Create new radio

HWSIM_CMD_DEL_RADIOnumber

Delete radio

HWSIM_CMD_GET_RADIOnumber

Get radio information

HWSIM_CMD_ADD_MAC_ADDRnumber

Add MAC address

HWSIM_CMD_DEL_MAC_ADDRnumber

Delete MAC address

HWSIM_CMD_START_PMSRnumber

Start peer measurement

HWSIM_CMD_ABORT_PMSRnumber

Abort peer measurement

HWSIM_CMD_REPORT_PMSRnumber

Report peer measurement

Interface types

Properties
NameTypeDescription
NL80211_IFTYPE_ADHOCnumber

IBSS/ad-hoc interface

NL80211_IFTYPE_STATIONnumber

Station interface

NL80211_IFTYPE_APnumber

Access point interface

NL80211_IFTYPE_AP_VLANnumber

AP VLAN interface

NL80211_IFTYPE_WDSnumber

WDS interface

NL80211_IFTYPE_MONITORnumber

Monitor interface

NL80211_IFTYPE_MESH_POINTnumber

Mesh point interface

NL80211_IFTYPE_P2P_CLIENTnumber

P2P client interface

NL80211_IFTYPE_P2P_GOnumber

P2P group owner interface

NL80211_IFTYPE_P2P_DEVICEnumber

P2P device interface

NL80211_IFTYPE_OCBnumber

Outside context of BSS (OCB) interface

Netlink message flags

Properties
NameTypeDescription
NLM_F_ACKnumber

Request for acknowledgment

NLM_F_ACK_TLVSnumber

Request for acknowledgment with TLVs

NLM_F_APPENDnumber

Append to existing list

NLM_F_ATOMICnumber

Atomic operation

NLM_F_CAPPEDnumber

Request capped

NLM_F_CREATEnumber

Create if not exists

NLM_F_DUMPnumber

Dump request

NLM_F_DUMP_FILTEREDnumber

Dump filtered request

NLM_F_DUMP_INTRnumber

Dump interrupted

NLM_F_ECHOnumber

Echo request

NLM_F_EXCLnumber

Exclusive creation

NLM_F_MATCHnumber

Match request

NLM_F_MULTInumber

Multi-part message

NLM_F_NONRECnumber

Non-recursive operation

NLM_F_REPLACEnumber

Replace existing

NLM_F_REQUESTnumber

Request message

NLM_F_ROOTnumber

Root operation

nl80211 commands

Properties
NameTypeDescription
NL80211_CMD_GET_WIPHYnumber

Get wireless PHY attributes

NL80211_CMD_SET_WIPHYnumber

Set wireless PHY attributes

NL80211_CMD_NEW_WIPHYnumber

Create new wireless PHY

NL80211_CMD_DEL_WIPHYnumber

Delete wireless PHY

NL80211_CMD_GET_INTERFACEnumber

Get interface information

NL80211_CMD_SET_INTERFACEnumber

Set interface attributes

NL80211_CMD_NEW_INTERFACEnumber

Create new interface

NL80211_CMD_DEL_INTERFACEnumber

Delete interface

NL80211_CMD_GET_KEYnumber

Get key

NL80211_CMD_SET_KEYnumber

Set key

NL80211_CMD_NEW_KEYnumber

Add new key

NL80211_CMD_DEL_KEYnumber

Delete key

NL80211_CMD_GET_BEACONnumber

Get beacon

NL80211_CMD_SET_BEACONnumber

Set beacon

NL80211_CMD_NEW_BEACONnumber

Set beacon (alias)

NL80211_CMD_STOP_APnumber

Stop AP operation

NL80211_CMD_DEL_BEACONnumber

Delete beacon

NL80211_CMD_GET_STATIONnumber

Get station information

NL80211_CMD_SET_STATIONnumber

Set station attributes

NL80211_CMD_NEW_STATIONnumber

Add new station

NL80211_CMD_DEL_STATIONnumber

Delete station

NL80211_CMD_GET_MPATHnumber

Get mesh path

NL80211_CMD_SET_MPATHnumber

Set mesh path

NL80211_CMD_NEW_MPATHnumber

Add new mesh path

NL80211_CMD_DEL_MPATHnumber

Delete mesh path

NL80211_CMD_SET_BSSnumber

Set BSS attributes

NL80211_CMD_SET_REGnumber

Set regulatory domain

NL80211_CMD_REQ_SET_REGnumber

Request regulatory domain change

NL80211_CMD_GET_MESH_CONFIGnumber

Get mesh configuration

NL80211_CMD_SET_MESH_CONFIGnumber

Set mesh configuration

NL80211_CMD_GET_REGnumber

Get regulatory domain

NL80211_CMD_GET_SCANnumber

Get scan results

NL80211_CMD_TRIGGER_SCANnumber

Trigger scan

NL80211_CMD_NEW_SCAN_RESULTSnumber

New scan results available

NL80211_CMD_SCAN_ABORTEDnumber

Scan aborted

NL80211_CMD_REG_CHANGEnumber

Regulatory domain change

NL80211_CMD_AUTHENTICATEnumber

Authenticate

NL80211_CMD_ASSOCIATEnumber

Associate

NL80211_CMD_DEAUTHENTICATEnumber

Deauthenticate

NL80211_CMD_DISASSOCIATEnumber

Disassociate

NL80211_CMD_MICHAEL_MIC_FAILUREnumber

Michael MIC failure

NL80211_CMD_REG_BEACON_HINTnumber

Beacon regulatory hint

NL80211_CMD_JOIN_IBSSnumber

Join IBSS

NL80211_CMD_LEAVE_IBSSnumber

Leave IBSS

NL80211_CMD_TESTMODEnumber

Test mode

NL80211_CMD_CONNECTnumber

Connect

NL80211_CMD_ROAMnumber

Roam

NL80211_CMD_DISCONNECTnumber

Disconnect

NL80211_CMD_SET_WIPHY_NETNSnumber

Set wireless PHY network namespace

NL80211_CMD_GET_SURVEYnumber

Get survey data

NL80211_CMD_NEW_SURVEY_RESULTSnumber

New survey results

NL80211_CMD_SET_PMKSAnumber

Set PMKSA

NL80211_CMD_DEL_PMKSAnumber

Delete PMKSA

NL80211_CMD_FLUSH_PMKSAnumber

Flush PMKSA

NL80211_CMD_REMAIN_ON_CHANNELnumber

Remain on channel

NL80211_CMD_CANCEL_REMAIN_ON_CHANNELnumber

Cancel remain on channel

NL80211_CMD_SET_TX_BITRATE_MASKnumber

Set TX bitrate mask

NL80211_CMD_REGISTER_FRAMEnumber

Register frame

NL80211_CMD_REGISTER_ACTIONnumber

Register action frame

NL80211_CMD_FRAMEnumber

Frame

NL80211_CMD_ACTIONnumber

Action frame

NL80211_CMD_FRAME_TX_STATUSnumber

Frame TX status

NL80211_CMD_ACTION_TX_STATUSnumber

Action TX status

NL80211_CMD_SET_POWER_SAVEnumber

Set power save

NL80211_CMD_GET_POWER_SAVEnumber

Get power save

NL80211_CMD_SET_CQMnumber

Set CQM

NL80211_CMD_NOTIFY_CQMnumber

Notify CQM

NL80211_CMD_SET_CHANNELnumber

Set channel

NL80211_CMD_SET_WDS_PEERnumber

Set WDS peer

NL80211_CMD_FRAME_WAIT_CANCELnumber

Cancel frame wait

NL80211_CMD_JOIN_MESHnumber

Join mesh

NL80211_CMD_LEAVE_MESHnumber

Leave mesh

NL80211_CMD_UNPROT_DEAUTHENTICATEnumber

Unprotected deauthenticate

NL80211_CMD_UNPROT_DISASSOCIATEnumber

Unprotected disassociate

NL80211_CMD_NEW_PEER_CANDIDATEnumber

New peer candidate

NL80211_CMD_GET_WOWLANnumber

Get WoWLAN

NL80211_CMD_SET_WOWLANnumber

Set WoWLAN

NL80211_CMD_START_SCHED_SCANnumber

Start scheduled scan

NL80211_CMD_STOP_SCHED_SCANnumber

Stop scheduled scan

NL80211_CMD_SCHED_SCAN_RESULTSnumber

Scheduled scan results

NL80211_CMD_SCHED_SCAN_STOPPEDnumber

Scheduled scan stopped

NL80211_CMD_SET_REKEY_OFFLOADnumber

Set rekey offload

NL80211_CMD_PMKSA_CANDIDATEnumber

PMKSA candidate

NL80211_CMD_TDLS_OPERnumber

TDLS operation

NL80211_CMD_TDLS_MGMTnumber

TDLS management

NL80211_CMD_UNEXPECTED_FRAMEnumber

Unexpected frame

NL80211_CMD_PROBE_CLIENTnumber

Probe client

NL80211_CMD_REGISTER_BEACONSnumber

Register beacons

NL80211_CMD_UNEXPECTED_4ADDR_FRAMEnumber

Unexpected 4-address frame

NL80211_CMD_SET_NOACK_MAPnumber

Set no-ack map

NL80211_CMD_CH_SWITCH_NOTIFYnumber

Channel switch notify

NL80211_CMD_START_P2P_DEVICEnumber

Start P2P device

NL80211_CMD_STOP_P2P_DEVICEnumber

Stop P2P device

NL80211_CMD_CONN_FAILEDnumber

Connection failed

NL80211_CMD_SET_MCAST_RATEnumber

Set multicast rate

NL80211_CMD_SET_MAC_ACLnumber

Set MAC ACL

NL80211_CMD_RADAR_DETECTnumber

Radar detect

NL80211_CMD_GET_PROTOCOL_FEATURESnumber

Get protocol features

NL80211_CMD_UPDATE_FT_IESnumber

Update FT IEs

NL80211_CMD_FT_EVENTnumber

FT event

NL80211_CMD_CRIT_PROTOCOL_STARTnumber

Start critical protocol

NL80211_CMD_CRIT_PROTOCOL_STOPnumber

Stop critical protocol

NL80211_CMD_GET_COALESCEnumber

Get coalesce

NL80211_CMD_SET_COALESCEnumber

Set coalesce

NL80211_CMD_CHANNEL_SWITCHnumber

Channel switch

NL80211_CMD_VENDORnumber

Vendor command

NL80211_CMD_SET_QOS_MAPnumber

Set QoS map

NL80211_CMD_ADD_TX_TSnumber

Add TX TS

NL80211_CMD_DEL_TX_TSnumber

Delete TX TS

NL80211_CMD_GET_MPPnumber

Get MPP

NL80211_CMD_JOIN_OCBnumber

Join OCB

NL80211_CMD_LEAVE_OCBnumber

Leave OCB

NL80211_CMD_CH_SWITCH_STARTED_NOTIFYnumber

Channel switch started notify

NL80211_CMD_TDLS_CHANNEL_SWITCHnumber

TDLS channel switch

NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCHnumber

Cancel TDLS channel switch