iPXE
Data Structures | Macros | Enumerations | Functions
net80211.h File Reference

The iPXE 802.11 MAC layer. More...

#include <ipxe/process.h>
#include <ipxe/ieee80211.h>
#include <ipxe/iobuf.h>
#include <ipxe/netdevice.h>
#include <ipxe/rc80211.h>

Go to the source code of this file.

Data Structures

struct  net80211_device_operations
 Operations that must be implemented by an 802.11 driver. More...
 
struct  net80211_channel
 An 802.11 RF channel. More...
 
struct  net80211_hw_info
 Information on the capabilities of an 802.11 hardware device. More...
 
struct  net80211_frag_cache
 Structure tracking received fragments for a packet. More...
 
struct  net80211_handshaker
 Interface to an 802.11 security handshaking protocol. More...
 
struct  net80211_crypto
 Interface to an 802.11 cryptosystem. More...
 
struct  net80211_device
 Structure encapsulating the complete state of an 802.11 device. More...
 
struct  net80211_wlan
 Structure representing a probed network. More...
 

Macros

#define NET80211_BAND_2GHZ   0
 The 2.4 GHz ISM band, unlicensed in most countries. More...
 
#define NET80211_BAND_5GHZ   1
 The band from 4.9 GHz to 5.7 GHz, which tends to be more restricted. More...
 
#define NET80211_NR_BANDS   2
 Number of RF bands. More...
 
#define NET80211_BAND_BIT_2GHZ   (1 << 0)
 Bitmask for the 2GHz band. More...
 
#define NET80211_BAND_BIT_5GHZ   (1 << 1)
 Bitmask for the 5GHz band. More...
 
#define NET80211_MODE_A   (1 << 0)
 802.11a: 54 Mbps operation using OFDM signaling on the 5GHz band More...
 
#define NET80211_MODE_B   (1 << 1)
 802.11b: 1-11 Mbps operation using DSSS/CCK signaling on the 2.4GHz band More...
 
#define NET80211_MODE_G   (1 << 2)
 802.11g: 54 Mbps operation using ERP/OFDM signaling on the 2.4GHz band More...
 
#define NET80211_MODE_N   (1 << 3)
 802.11n: High-rate operation using MIMO technology on 2.4GHz or 5GHz More...
 
#define NET80211_CFG_CHANNEL   (1 << 0)
 Channel choice (dev->channel) or regulatory parameters have changed. More...
 
#define NET80211_CFG_RATE   (1 << 1)
 Requested transmission rate (dev->rate) has changed. More...
 
#define NET80211_CFG_ASSOC   (1 << 2)
 Association has been established with a new BSS (dev->bssid) More...
 
#define NET80211_CFG_PHY_PARAMS   (1 << 3)
 Low-level link parameters (short preamble, protection, etc) have changed. More...
 
#define NET80211_STATUS_MASK   0x7F
 An error code indicating the failure mode, or 0 if successful. More...
 
#define NET80211_IS_REASON   0x80
 Whether the error code provided is a "reason" code, not a "status" code. More...
 
#define NET80211_PROBED   (1 << 8)
 Whether we have found the network we will be associating with. More...
 
#define NET80211_AUTHENTICATED   (1 << 9)
 Whether we have successfully authenticated with the network. More...
 
#define NET80211_ASSOCIATED   (1 << 10)
 Whether we have successfully associated with the network. More...
 
#define NET80211_CRYPTO_SYNCED   (1 << 11)
 Whether we have completed security handshaking with the network. More...
 
#define NET80211_WORKING   (1 << 12)
 Whether the auto-association task is running. More...
 
#define NET80211_WAITING   (1 << 13)
 Whether the auto-association task is waiting for a reply from the AP. More...
 
#define NET80211_NO_ASSOC   (1 << 14)
 Whether the auto-association task should be suppressed. More...
 
#define NET80211_AUTO_SSID   (1 << 15)
 Whether this association was performed using a broadcast SSID. More...
 
#define NET80211_PHY_USE_PROTECTION   (1 << 1)
 Whether to use RTS/CTS or CTS-to-self protection for transmissions. More...
 
#define NET80211_PHY_USE_SHORT_PREAMBLE   (1 << 2)
 Whether to use 802.11b short preamble operation. More...
 
#define NET80211_PHY_USE_SHORT_SLOT   (1 << 3)
 Whether to use 802.11g short slot operation. More...
 
#define NET80211_MAX_RATES   16
 The maximum number of TX rates we allow to be configured simultaneously. More...
 
#define NET80211_MAX_CHANNELS   40
 The maximum number of channels we allow to be configured simultaneously. More...
 
#define NET80211_FRAG_TIMEOUT   2
 Seconds we'll wait to get all fragments of a packet. More...
 
#define NET80211_NR_CONCURRENT_FRAGS   3
 The number of fragments we can receive at once. More...
 
#define NET80211_REG_TXPOWER   20
 Maximum TX power to allow (dBm), if we don't get a regulatory hint. More...
 
#define NET80211_HANDSHAKERS
 
#define __net80211_handshaker   __table_entry ( NET80211_HANDSHAKERS, 01 )
 
#define NET80211_CRYPTOS   __table ( struct net80211_crypto, "net80211_cryptos" )
 
#define __net80211_crypto   __table_entry ( NET80211_CRYPTOS, 01 )
 

Enumerations

enum  net80211_security_proto { NET80211_SECPROT_NONE = 0, NET80211_SECPROT_PSK = 1, NET80211_SECPROT_EAP = 2, NET80211_SECPROT_UNKNOWN = 3 }
 An 802.11 security handshaking protocol. More...
 
enum  net80211_crypto_alg {
  NET80211_CRYPT_NONE = 0, NET80211_CRYPT_WEP = 1, NET80211_CRYPT_TKIP = 2, NET80211_CRYPT_CCMP = 3,
  NET80211_CRYPT_UNKNOWN = 4
}
 An 802.11 data encryption algorithm. More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER)
 
const struct setting net80211_key_setting __setting (SETTING_NETDEV_EXTRA, key)
 802.11 encryption key setting More...
 
int net80211_prepare_probe (struct net80211_device *dev, int band, int active)
 Prepare 802.11 device channel and rate set for scanning. More...
 
struct net80211_probe_ctxnet80211_probe_start (struct net80211_device *dev, const char *essid, int active)
 Begin probe of 802.11 networks. More...
 
int net80211_probe_step (struct net80211_probe_ctx *ctx)
 Continue probe of 802.11 networks. More...
 
struct net80211_wlannet80211_probe_finish_best (struct net80211_probe_ctx *ctx)
 Finish probe of 802.11 networks, returning best-signal network found. More...
 
struct list_headnet80211_probe_finish_all (struct net80211_probe_ctx *ctx)
 Finish probe of 802.11 networks, returning all networks found. More...
 
void net80211_free_wlan (struct net80211_wlan *wlan)
 Free WLAN structure. More...
 
void net80211_free_wlanlist (struct list_head *list)
 Free list of WLAN structures. More...
 
struct net80211_devicenet80211_get (struct net_device *netdev)
 Get 802.11 device from wrapping network device. More...
 
void net80211_autoassociate (struct net80211_device *dev)
 Start 802.11 association process. More...
 
int net80211_change_channel (struct net80211_device *dev, int channel)
 Configure 802.11 device to transmit on a certain channel. More...
 
void net80211_set_rate_idx (struct net80211_device *dev, int rate)
 Set data transmission rate for 802.11 device. More...
 
int net80211_keep_mgmt (struct net80211_device *dev, int enable)
 Set state of 802.11 device keeping management frames. More...
 
struct io_buffernet80211_mgmt_dequeue (struct net80211_device *dev, int *signal)
 Get 802.11 management frame. More...
 
int net80211_tx_mgmt (struct net80211_device *dev, u16 fc, u8 bssid[ETH_ALEN], struct io_buffer *iob)
 
int net80211_prepare_assoc (struct net80211_device *dev, struct net80211_wlan *wlan)
 Prepare 802.11 device channel and rate set for communication. More...
 
int net80211_send_auth (struct net80211_device *dev, struct net80211_wlan *wlan, int method)
 Send 802.11 initial authentication frame. More...
 
int net80211_send_assoc (struct net80211_device *dev, struct net80211_wlan *wlan)
 Send 802.11 association frame. More...
 
void net80211_deauthenticate (struct net80211_device *dev, int rc)
 Deauthenticate from current network and try again. More...
 
struct net80211_devicenet80211_alloc (size_t priv_size)
 Allocate 802.11 device. More...
 
int net80211_register (struct net80211_device *dev, struct net80211_device_operations *ops, struct net80211_hw_info *hw)
 Register 802.11 device with network stack. More...
 
u16 net80211_duration (struct net80211_device *dev, int bytes, u16 rate)
 Calculate one frame's contribution to 802.11 duration field. More...
 
void net80211_rx (struct net80211_device *dev, struct io_buffer *iob, int signal, u16 rate)
 Handle receipt of 802.11 frame. More...
 
void net80211_rx_err (struct net80211_device *dev, struct io_buffer *iob, int rc)
 Indicate an error in receiving a packet. More...
 
void net80211_tx_complete (struct net80211_device *dev, struct io_buffer *iob, int retries, int rc)
 Indicate the completed transmission of a packet. More...
 
void net80211_unregister (struct net80211_device *dev)
 Unregister 802.11 device from network stack. More...
 
void net80211_free (struct net80211_device *dev)
 Free 802.11 device. More...
 
static u16 net80211_cts_duration (struct net80211_device *dev, int size)
 Calculate duration field for a CTS control frame. More...
 

Detailed Description

The iPXE 802.11 MAC layer.

Definition in file net80211.h.

Macro Definition Documentation

◆ NET80211_MAX_RATES

#define NET80211_MAX_RATES   16

The maximum number of TX rates we allow to be configured simultaneously.

Definition at line 272 of file net80211.h.

◆ NET80211_MAX_CHANNELS

#define NET80211_MAX_CHANNELS   40

The maximum number of channels we allow to be configured simultaneously.

Definition at line 275 of file net80211.h.

◆ NET80211_FRAG_TIMEOUT

#define NET80211_FRAG_TIMEOUT   2

Seconds we'll wait to get all fragments of a packet.

Definition at line 278 of file net80211.h.

◆ NET80211_NR_CONCURRENT_FRAGS

#define NET80211_NR_CONCURRENT_FRAGS   3

The number of fragments we can receive at once.

The 802.11 standard requires that this be at least 3.

Definition at line 284 of file net80211.h.

◆ NET80211_REG_TXPOWER

#define NET80211_REG_TXPOWER   20

Maximum TX power to allow (dBm), if we don't get a regulatory hint.

Definition at line 287 of file net80211.h.

◆ NET80211_HANDSHAKERS

#define NET80211_HANDSHAKERS
Value:
"net80211_handshakers" )
#define __table(type, name)
Declare a linker table.
Definition: tables.h:179
Interface to an 802.11 security handshaking protocol.
Definition: net80211.h:564

Definition at line 675 of file net80211.h.

◆ __net80211_handshaker

#define __net80211_handshaker   __table_entry ( NET80211_HANDSHAKERS, 01 )

Definition at line 677 of file net80211.h.

◆ NET80211_CRYPTOS

#define NET80211_CRYPTOS   __table ( struct net80211_crypto, "net80211_cryptos" )

Definition at line 769 of file net80211.h.

◆ __net80211_crypto

#define __net80211_crypto   __table_entry ( NET80211_CRYPTOS, 01 )

Definition at line 770 of file net80211.h.

Enumeration Type Documentation

◆ net80211_security_proto

An 802.11 security handshaking protocol.

Enumerator
NET80211_SECPROT_NONE 

No security handshaking.

   This might be used with an open network or with WEP, as
   WEP does not have a cryptographic handshaking phase.
NET80211_SECPROT_PSK 

Pre-shared key handshaking.

   This implements the "WPA Personal" handshake. 802.1X
   authentication is not performed -- the user supplies a
   pre-shared key directly -- but there is a 4-way handshake
   between client and AP to verify that both have the same key
   without revealing the contents of that key.
NET80211_SECPROT_EAP 

Full EAP 802.1X handshaking.

   This implements the "WPA Enterprise" handshake, connecting
   to an 802.1X authentication server to provide credentials
   and receive a pairwise master key (PMK), which is then used
   in the same 4-way handshake as the PSK method.
NET80211_SECPROT_UNKNOWN 

Dummy value used when the handshaking type can't be detected.

Definition at line 96 of file net80211.h.

96  {
97  /** No security handshaking
98  *
99  * This might be used with an open network or with WEP, as
100  * WEP does not have a cryptographic handshaking phase.
101  */
103 
104  /** Pre-shared key handshaking
105  *
106  * This implements the "WPA Personal" handshake. 802.1X
107  * authentication is not performed -- the user supplies a
108  * pre-shared key directly -- but there is a 4-way handshake
109  * between client and AP to verify that both have the same key
110  * without revealing the contents of that key.
111  */
113 
114  /** Full EAP 802.1X handshaking
115  *
116  * This implements the "WPA Enterprise" handshake, connecting
117  * to an 802.1X authentication server to provide credentials
118  * and receive a pairwise master key (PMK), which is then used
119  * in the same 4-way handshake as the PSK method.
120  */
122 
123  /** Dummy value used when the handshaking type can't be detected */
125 };
No security handshaking.
Definition: net80211.h:102
Full EAP 802.1X handshaking.
Definition: net80211.h:121
Dummy value used when the handshaking type can't be detected.
Definition: net80211.h:124
Pre-shared key handshaking.
Definition: net80211.h:112

◆ net80211_crypto_alg

An 802.11 data encryption algorithm.

Enumerator
NET80211_CRYPT_NONE 

No security, an "Open" network.

NET80211_CRYPT_WEP 

Network protected with WEP (awful RC4-based system)

   WEP uses a naive application of RC4, with a monotonically
   increasing initialization vector that is prepended to the
   key to initialize the RC4 keystream. It is highly insecure
   and can be completely cracked or subverted using automated,
   robust, freely available tools (aircrack-ng) in minutes.

   40-bit and 104-bit WEP are differentiated only by the size
   of the key. They may be advertised as 64-bit and 128-bit,
   counting the non-random IV as part of the key bits.
NET80211_CRYPT_TKIP 

Network protected with TKIP (better RC4-based system)

   Usually known by its trade name of WPA (Wi-Fi Protected
   Access), TKIP implements a message integrity code (MIC)
   called Michael, a timestamp counter for replay prevention,
   and a key mixing function that together remove almost all
   the security problems with WEP. Countermeasures are
   implemented to prevent high data-rate attacks.

   There exists one known attack on TKIP, that allows one to
   send between 7 and 15 arbitrary short data packets on a
   QoS-enabled network given about an hour of data
   gathering. Since iPXE does not support QoS for 802.11
   networks, this is not a threat to us. The only other method
   is a brute-force passphrase attack.
NET80211_CRYPT_CCMP 

Network protected with CCMP (AES-based system)

   Often called WPA2 in commerce, or RSNA (Robust Security
   Network Architecture) in the 802.11 standard, CCMP is
   highly secure and does not have any known attack vectors.
   Since it is based on a block cipher, the statistical
   correlation and "chopchop" attacks used with great success
   against WEP and minor success against TKIP fail.
NET80211_CRYPT_UNKNOWN 

Dummy value used when the cryptosystem can't be detected.

Definition at line 129 of file net80211.h.

129  {
130  /** No security, an "Open" network */
132 
133  /** Network protected with WEP (awful RC4-based system)
134  *
135  * WEP uses a naive application of RC4, with a monotonically
136  * increasing initialization vector that is prepended to the
137  * key to initialize the RC4 keystream. It is highly insecure
138  * and can be completely cracked or subverted using automated,
139  * robust, freely available tools (aircrack-ng) in minutes.
140  *
141  * 40-bit and 104-bit WEP are differentiated only by the size
142  * of the key. They may be advertised as 64-bit and 128-bit,
143  * counting the non-random IV as part of the key bits.
144  */
145  NET80211_CRYPT_WEP = 1,
146 
147  /** Network protected with TKIP (better RC4-based system)
148  *
149  * Usually known by its trade name of WPA (Wi-Fi Protected
150  * Access), TKIP implements a message integrity code (MIC)
151  * called Michael, a timestamp counter for replay prevention,
152  * and a key mixing function that together remove almost all
153  * the security problems with WEP. Countermeasures are
154  * implemented to prevent high data-rate attacks.
155  *
156  * There exists one known attack on TKIP, that allows one to
157  * send between 7 and 15 arbitrary short data packets on a
158  * QoS-enabled network given about an hour of data
159  * gathering. Since iPXE does not support QoS for 802.11
160  * networks, this is not a threat to us. The only other method
161  * is a brute-force passphrase attack.
162  */
164 
165  /** Network protected with CCMP (AES-based system)
166  *
167  * Often called WPA2 in commerce, or RSNA (Robust Security
168  * Network Architecture) in the 802.11 standard, CCMP is
169  * highly secure and does not have any known attack vectors.
170  * Since it is based on a block cipher, the statistical
171  * correlation and "chopchop" attacks used with great success
172  * against WEP and minor success against TKIP fail.
173  */
175 
176  /** Dummy value used when the cryptosystem can't be detected */
178 };
Network protected with CCMP (AES-based system)
Definition: net80211.h:174
Dummy value used when the cryptosystem can't be detected.
Definition: net80211.h:177
Network protected with WEP (awful RC4-based system)
Definition: net80211.h:145
No security, an "Open" network.
Definition: net80211.h:131
Network protected with TKIP (better RC4-based system)
Definition: net80211.h:163

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER  )

◆ __setting()

const struct setting net80211_key_setting __setting ( SETTING_NETDEV_EXTRA  ,
key   
)

802.11 encryption key setting

◆ net80211_cts_duration()

static u16 net80211_cts_duration ( struct net80211_device dev,
int  size 
)
inlinestatic

Calculate duration field for a CTS control frame.

Parameters
dev802.11 device
sizeSize of the packet being cleared to send

A CTS control frame's duration field captures the frame being protected and its 10-byte ACK.

Definition at line 1179 of file net80211.h.

1181 {
1182  return ( net80211_duration ( dev, 10,
1183  dev->rates[dev->rtscts_rate] ) +
1184  net80211_duration ( dev, size, dev->rates[dev->rate] ) );
1185 }
u8 rtscts_rate
The rate to use for RTS/CTS transmissions.
Definition: net80211.h:831
u16 net80211_duration(struct net80211_device *dev, int bytes, u16 rate)
Calculate one frame's contribution to 802.11 duration field.
Definition: net80211.c:441
u16 rates[NET80211_MAX_RATES]
A list of all possible TX rates we might use.
Definition: net80211.h:818
uint8_t size
Entry size (in 32-bit words)
Definition: ena.h:16
u8 rate
The rate currently in use, as an index into the rates array.
Definition: net80211.h:824

References net80211_duration(), net80211_device::rate, net80211_device::rates, net80211_device::rtscts_rate, and size.

Referenced by ath5k_txbuf_setup(), and rtl818x_tx().