iPXE
Data Structures | Defines | 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...

Defines

#define NET80211_BAND_2GHZ   0
 The 2.4 GHz ISM band, unlicensed in most countries.
#define NET80211_BAND_5GHZ   1
 The band from 4.9 GHz to 5.7 GHz, which tends to be more restricted.
#define NET80211_NR_BANDS   2
 Number of RF bands.
#define NET80211_BAND_BIT_2GHZ   (1 << 0)
 Bitmask for the 2GHz band.
#define NET80211_BAND_BIT_5GHZ   (1 << 1)
 Bitmask for the 5GHz band.
#define NET80211_MODE_A   (1 << 0)
 802.11a: 54 Mbps operation using OFDM signaling on the 5GHz band
#define NET80211_MODE_B   (1 << 1)
 802.11b: 1-11 Mbps operation using DSSS/CCK signaling on the 2.4GHz band
#define NET80211_MODE_G   (1 << 2)
 802.11g: 54 Mbps operation using ERP/OFDM signaling on the 2.4GHz band
#define NET80211_MODE_N   (1 << 3)
 802.11n: High-rate operation using MIMO technology on 2.4GHz or 5GHz
#define NET80211_CFG_CHANNEL   (1 << 0)
 Channel choice (dev->channel) or regulatory parameters have changed.
#define NET80211_CFG_RATE   (1 << 1)
 Requested transmission rate (dev->rate) has changed.
#define NET80211_CFG_ASSOC   (1 << 2)
 Association has been established with a new BSS (dev->bssid)
#define NET80211_CFG_PHY_PARAMS   (1 << 3)
 Low-level link parameters (short preamble, protection, etc) have changed.
#define NET80211_STATUS_MASK   0x7F
 An error code indicating the failure mode, or 0 if successful.
#define NET80211_IS_REASON   0x80
 Whether the error code provided is a "reason" code, not a "status" code.
#define NET80211_PROBED   (1 << 8)
 Whether we have found the network we will be associating with.
#define NET80211_AUTHENTICATED   (1 << 9)
 Whether we have successfully authenticated with the network.
#define NET80211_ASSOCIATED   (1 << 10)
 Whether we have successfully associated with the network.
#define NET80211_CRYPTO_SYNCED   (1 << 11)
 Whether we have completed security handshaking with the network.
#define NET80211_WORKING   (1 << 12)
 Whether the auto-association task is running.
#define NET80211_WAITING   (1 << 13)
 Whether the auto-association task is waiting for a reply from the AP.
#define NET80211_NO_ASSOC   (1 << 14)
 Whether the auto-association task should be suppressed.
#define NET80211_AUTO_SSID   (1 << 15)
 Whether this association was performed using a broadcast SSID.
#define NET80211_PHY_USE_PROTECTION   (1 << 1)
 Whether to use RTS/CTS or CTS-to-self protection for transmissions.
#define NET80211_PHY_USE_SHORT_PREAMBLE   (1 << 2)
 Whether to use 802.11b short preamble operation.
#define NET80211_PHY_USE_SHORT_SLOT   (1 << 3)
 Whether to use 802.11g short slot operation.
#define NET80211_MAX_RATES   16
 The maximum number of TX rates we allow to be configured simultaneously.
#define NET80211_MAX_CHANNELS   40
 The maximum number of channels we allow to be configured simultaneously.
#define NET80211_FRAG_TIMEOUT   2
 Seconds we'll wait to get all fragments of a packet.
#define NET80211_NR_CONCURRENT_FRAGS   3
 The number of fragments we can receive at once.
#define NET80211_REG_TXPOWER   20
 Maximum TX power to allow (dBm), if we don't get a regulatory hint.
#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)
struct setting net80211_key_setting __setting (SETTING_NETDEV_EXTRA, key)
 802.11 encryption key setting
int net80211_prepare_probe (struct net80211_device *dev, int band, int active)
 Prepare 802.11 device channel and rate set for scanning.
struct net80211_probe_ctxnet80211_probe_start (struct net80211_device *dev, const char *essid, int active)
 Begin probe of 802.11 networks.
int net80211_probe_step (struct net80211_probe_ctx *ctx)
 Continue probe of 802.11 networks.
struct net80211_wlannet80211_probe_finish_best (struct net80211_probe_ctx *ctx)
 Finish probe of 802.11 networks, returning best-signal network found.
struct list_headnet80211_probe_finish_all (struct net80211_probe_ctx *ctx)
 Finish probe of 802.11 networks, returning all networks found.
void net80211_free_wlan (struct net80211_wlan *wlan)
 Free WLAN structure.
void net80211_free_wlanlist (struct list_head *list)
 Free list of WLAN structures.
struct net80211_devicenet80211_get (struct net_device *netdev)
 Get 802.11 device from wrapping network device.
void net80211_autoassociate (struct net80211_device *dev)
 Start 802.11 association process.
int net80211_change_channel (struct net80211_device *dev, int channel)
 Configure 802.11 device to transmit on a certain channel.
void net80211_set_rate_idx (struct net80211_device *dev, int rate)
 Set data transmission rate for 802.11 device.
int net80211_keep_mgmt (struct net80211_device *dev, int enable)
 Set state of 802.11 device keeping management frames.
struct io_buffernet80211_mgmt_dequeue (struct net80211_device *dev, int *signal)
 Get 802.11 management frame.
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.
int net80211_send_auth (struct net80211_device *dev, struct net80211_wlan *wlan, int method)
 Send 802.11 initial authentication frame.
int net80211_send_assoc (struct net80211_device *dev, struct net80211_wlan *wlan)
 Send 802.11 association frame.
void net80211_deauthenticate (struct net80211_device *dev, int rc)
 Deauthenticate from current network and try again.
struct net80211_devicenet80211_alloc (size_t priv_size)
 Allocate 802.11 device.
int net80211_register (struct net80211_device *dev, struct net80211_device_operations *ops, struct net80211_hw_info *hw)
 Register 802.11 device with network stack.
u16 net80211_duration (struct net80211_device *dev, int bytes, u16 rate)
 Calculate one frame's contribution to 802.11 duration field.
void net80211_rx (struct net80211_device *dev, struct io_buffer *iob, int signal, u16 rate)
 Handle receipt of 802.11 frame.
void net80211_rx_err (struct net80211_device *dev, struct io_buffer *iob, int rc)
 Indicate an error in receiving a packet.
void net80211_tx_complete (struct net80211_device *dev, struct io_buffer *iob, int retries, int rc)
 Indicate the completed transmission of a packet.
void net80211_unregister (struct net80211_device *dev)
 Unregister 802.11 device from network stack.
void net80211_free (struct net80211_device *dev)
 Free 802.11 device.
static u16 net80211_cts_duration (struct net80211_device *dev, int size)
 Calculate duration field for a CTS control frame.

Detailed Description

The iPXE 802.11 MAC layer.

Definition in file net80211.h.


Define Documentation

#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.

Referenced by ath9k_config(), and net80211_process_ie().

#define NET80211_MAX_CHANNELS   40

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

Definition at line 275 of file net80211.h.

Referenced by net80211_add_channels(), and net80211_register().

#define NET80211_FRAG_TIMEOUT   2

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

Definition at line 278 of file net80211.h.

Referenced by net80211_rx_frag().

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.

Referenced by net80211_rx_frag().

#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.

Referenced by net80211_prepare_probe().

Value:
__table ( struct net80211_handshaker, \
                                       "net80211_handshakers" )

Definition at line 675 of file net80211.h.

Referenced by net80211_prepare_assoc(), and sec80211_detect_ie().

Definition at line 677 of file net80211.h.

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

Definition at line 769 of file net80211.h.

Referenced by sec80211_detect_ie(), sec80211_install(), and wpa_find_cryptosystem().

Definition at line 770 of file net80211.h.


Enumeration Type Documentation

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.

                             {
        /** 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_NONE = 0,

        /** 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_PSK = 1,

        /** 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_EAP = 2,

        /** Dummy value used when the handshaking type can't be detected */
        NET80211_SECPROT_UNKNOWN = 3,
};

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.

                         {
        /** No security, an "Open" network */
        NET80211_CRYPT_NONE = 0,

        /** 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_WEP = 1,

        /** 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_TKIP = 2,

        /** 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_CCMP = 3,

        /** Dummy value used when the cryptosystem can't be detected */
        NET80211_CRYPT_UNKNOWN = 4,
};

Function Documentation

FILE_LICENCE ( GPL2_OR_LATER  )
struct setting net80211_key_setting __setting ( SETTING_NETDEV_EXTRA  ,
key   
) [read]

802.11 encryption key setting

static u16 net80211_cts_duration ( struct net80211_device dev,
int  size 
) [inline, static]

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.

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

Referenced by ath5k_txbuf_setup(), and rtl818x_tx().

{
        return ( net80211_duration ( dev, 10,
                                     dev->rates[dev->rtscts_rate] ) +
                 net80211_duration ( dev, size, dev->rates[dev->rate] ) );
}