wpa_supplicant / hostapd
2.5
|
Driver interaction with generic Linux Wireless Extensions. More...
#include "includes.h"
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <net/if_arp.h>
#include <dirent.h>
#include "linux_wext.h"
#include "common.h"
#include "eloop.h"
#include "common/ieee802_11_defs.h"
#include "common/wpa_common.h"
#include "priv_netlink.h"
#include "netlink.h"
#include "linux_ioctl.h"
#include "rfkill.h"
#include "driver.h"
#include "driver_wext.h"
Data Structures | |
struct | wext_scan_data |
Functions | |
int | wpa_driver_wext_set_auth_param (struct wpa_driver_wext_data *drv, int idx, u32 value) |
int | wpa_driver_wext_get_bssid (void *priv, u8 *bssid) |
Get BSSID, SIOCGIWAP. More... | |
int | wpa_driver_wext_set_bssid (void *priv, const u8 *bssid) |
Set BSSID, SIOCSIWAP. More... | |
int | wpa_driver_wext_get_ssid (void *priv, u8 *ssid) |
Get SSID, SIOCGIWESSID. More... | |
int | wpa_driver_wext_set_ssid (void *priv, const u8 *ssid, size_t ssid_len) |
Set SSID, SIOCSIWESSID. More... | |
int | wpa_driver_wext_set_freq (void *priv, int freq) |
Set frequency/channel, SIOCSIWFREQ. More... | |
void * | wpa_driver_wext_init (void *ctx, const char *ifname) |
Initialize WE driver interface. More... | |
void | wpa_driver_wext_deinit (void *priv) |
Deinitialize WE driver interface. More... | |
void | wpa_driver_wext_scan_timeout (void *eloop_ctx, void *timeout_ctx) |
Scan timeout to report scan completion. More... | |
int | wpa_driver_wext_scan (void *priv, struct wpa_driver_scan_params *params) |
Request the driver to initiate scan. More... | |
struct wpa_scan_results * | wpa_driver_wext_get_scan_results (void *priv) |
Fetch the latest scan results. More... | |
int | wpa_driver_wext_set_key (const char *ifname, void *priv, enum wpa_alg alg, const u8 *addr, int key_idx, int set_tx, const u8 *seq, size_t seq_len, const u8 *key, size_t key_len) |
Configure encryption key. More... | |
int | wpa_driver_wext_cipher2wext (int cipher) |
int | wpa_driver_wext_keymgmt2wext (int keymgmt) |
int | wpa_driver_wext_associate (void *priv, struct wpa_driver_associate_params *params) |
int | wpa_driver_wext_set_mode (void *priv, int mode) |
Set wireless mode (infra/adhoc), SIOCSIWMODE. More... | |
int | wpa_driver_wext_get_capa (void *priv, struct wpa_driver_capa *capa) |
int | wpa_driver_wext_alternative_ifindex (struct wpa_driver_wext_data *drv, const char *ifname) |
int | wpa_driver_wext_set_operstate (void *priv, int state) |
int | wpa_driver_wext_get_version (struct wpa_driver_wext_data *drv) |
Variables | |
const struct wpa_driver_ops | wpa_driver_wext_ops |
Driver interaction with generic Linux Wireless Extensions.
This file implements a driver interface for the Linux Wireless Extensions. When used with WE-18 or newer, this interface can be used as-is with number of drivers. In addition to this, some of the common functions in this file can be used by other driver interface implementations that use generic WE ioctls, but require private ioctls for some of the functionality.
void wpa_driver_wext_deinit | ( | void * | priv | ) |
Deinitialize WE driver interface.
priv | Pointer to private wext data from wpa_driver_wext_init() |
Shut down driver interface and processing of driver events. Free private data buffer if one was allocated in wpa_driver_wext_init().
int wpa_driver_wext_get_bssid | ( | void * | priv, |
u8 * | bssid | ||
) |
Get BSSID, SIOCGIWAP.
priv | Pointer to private wext data from wpa_driver_wext_init() |
bssid | Buffer for BSSID |
struct wpa_scan_results* wpa_driver_wext_get_scan_results | ( | void * | priv | ) |
Fetch the latest scan results.
priv | Pointer to private wext data from wpa_driver_wext_init() |
int wpa_driver_wext_get_ssid | ( | void * | priv, |
u8 * | ssid | ||
) |
Get SSID, SIOCGIWESSID.
priv | Pointer to private wext data from wpa_driver_wext_init() |
ssid | Buffer for the SSID; must be at least 32 bytes long |
void* wpa_driver_wext_init | ( | void * | ctx, |
const char * | ifname | ||
) |
Initialize WE driver interface.
ctx | context to be used when calling wpa_supplicant functions, e.g., wpa_supplicant_event() |
ifname | interface name, e.g., wlan0 |
int wpa_driver_wext_scan | ( | void * | priv, |
struct wpa_driver_scan_params * | params | ||
) |
Request the driver to initiate scan.
priv | Pointer to private wext data from wpa_driver_wext_init() |
param | Scan parameters (specific SSID to scan for (ProbeReq), etc.) |
void wpa_driver_wext_scan_timeout | ( | void * | eloop_ctx, |
void * | timeout_ctx | ||
) |
Scan timeout to report scan completion.
eloop_ctx | Unused |
timeout_ctx | ctx argument given to wpa_driver_wext_init() |
This function can be used as registered timeout when starting a scan to generate a scan completed event if the driver does not report this.
int wpa_driver_wext_set_bssid | ( | void * | priv, |
const u8 * | bssid | ||
) |
Set BSSID, SIOCSIWAP.
priv | Pointer to private wext data from wpa_driver_wext_init() |
bssid | BSSID |
int wpa_driver_wext_set_freq | ( | void * | priv, |
int | freq | ||
) |
Set frequency/channel, SIOCSIWFREQ.
priv | Pointer to private wext data from wpa_driver_wext_init() |
freq | Frequency in MHz |
int wpa_driver_wext_set_key | ( | const char * | ifname, |
void * | priv, | ||
enum wpa_alg | alg, | ||
const u8 * | addr, | ||
int | key_idx, | ||
int | set_tx, | ||
const u8 * | seq, | ||
size_t | seq_len, | ||
const u8 * | key, | ||
size_t | key_len | ||
) |
Configure encryption key.
priv | Pointer to private wext data from wpa_driver_wext_init() |
priv | Private driver interface data |
alg | Encryption algorithm (WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP); WPA_ALG_NONE clears the key. |
addr | Address of the peer STA or ff:ff:ff:ff:ff:ff for broadcast/default keys |
key_idx | key index (0..3), usually 0 for unicast keys |
set_tx | Configure this key as the default Tx key (only used when driver does not support separate unicast/individual key |
seq | Sequence number/packet number, seq_len octets, the next packet number to be used for in replay protection; configured for Rx keys (in most cases, this is only used with broadcast keys and set to zero for unicast keys) |
seq_len | Length of the seq, depends on the algorithm: TKIP: 6 octets, CCMP: 6 octets |
key | Key buffer; TKIP: 16-byte temporal key, 8-byte Tx Mic key, 8-byte Rx Mic Key |
key_len | Length of the key buffer in octets (WEP: 5 or 13, TKIP: 32, CCMP: 16) |
This function uses SIOCSIWENCODEEXT by default, but tries to use SIOCSIWENCODE if the extended ioctl fails when configuring a WEP key.
int wpa_driver_wext_set_mode | ( | void * | priv, |
int | mode | ||
) |
Set wireless mode (infra/adhoc), SIOCSIWMODE.
priv | Pointer to private wext data from wpa_driver_wext_init() |
mode | 0 = infra/BSS (associate with an AP), 1 = adhoc/IBSS |
int wpa_driver_wext_set_ssid | ( | void * | priv, |
const u8 * | ssid, | ||
size_t | ssid_len | ||
) |
Set SSID, SIOCSIWESSID.
priv | Pointer to private wext data from wpa_driver_wext_init() |
ssid | SSID |
ssid_len | Length of SSID (0..32) |
const struct wpa_driver_ops wpa_driver_wext_ops |