driver_wext.c File Reference

WPA Supplicant - driver interaction with generic Linux Wireless Extensions. More...

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <net/if_arp.h>
#include "wireless_copy.h"
#include "common.h"
#include "driver.h"
#include "l2_packet.h"
#include "eloop.h"
#include "wpa_supplicant.h"
#include "priv_netlink.h"
#include "driver_wext.h"
#include "wpa.h"

Include dependency graph for driver_wext.c:

Go to the source code of this file.

Functions

int wpa_driver_wext_get_bssid (void *priv, u8 *bssid)
 Get BSSID, SIOCGIWAP.
int wpa_driver_wext_set_bssid (void *priv, const u8 *bssid)
 Set BSSID, SIOCSIWAP.
int wpa_driver_wext_get_ssid (void *priv, u8 *ssid)
 Get SSID, SIOCGIWESSID.
int wpa_driver_wext_set_ssid (void *priv, const u8 *ssid, size_t ssid_len)
 Set SSID, SIOCSIWESSID.
int wpa_driver_wext_set_freq (void *priv, int freq)
 Set frequency/channel, SIOCSIWFREQ.
int wpa_driver_wext_get_ifflags (struct wpa_driver_wext_data *drv, int *flags)
 Get interface flags (SIOCGIFFLAGS).
int wpa_driver_wext_set_ifflags (struct wpa_driver_wext_data *drv, int flags)
 Set interface flags (SIOCSIFFLAGS).
void * wpa_driver_wext_init (void *ctx, const char *ifname)
 Initialize WE driver interface.
void wpa_driver_wext_deinit (void *priv)
 Deinitialize WE driver interface.
void wpa_driver_wext_scan_timeout (void *eloop_ctx, void *timeout_ctx)
 Scan timeout to report scan completion.
int wpa_driver_wext_scan (void *priv, const u8 *ssid, size_t ssid_len)
 Request the driver to initiate scan.
int wpa_driver_wext_get_scan_results (void *priv, struct wpa_scan_result *results, size_t max_size)
 Fetch the latest scan results.
int wpa_driver_wext_set_key (void *priv, 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.
int wpa_driver_wext_set_mode (void *priv, int mode)
 Set wireless mode (infra/adhoc), SIOCSIWMODE.
int wpa_driver_wext_alternative_ifindex (struct wpa_driver_wext_data *drv, const char *ifname)

Variables

const struct wpa_driver_ops wpa_driver_wext_ops


Detailed Description

WPA Supplicant - driver interaction with generic Linux Wireless Extensions.

Copyright
Copyright (c) 2003-2006, Jouni Malinen <[email protected]>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

Alternatively, this software may be distributed under the terms of BSD license.

See README and COPYING for more details.

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.

Definition in file driver_wext.c.


Function Documentation

void wpa_driver_wext_deinit void *  priv  ) 
 

Deinitialize WE driver interface.

Parameters:
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().

Definition at line 827 of file driver_wext.c.

Here is the call graph for this function:

int wpa_driver_wext_get_bssid void *  priv,
u8 *  bssid
 

Get BSSID, SIOCGIWAP.

Parameters:
priv Pointer to private wext data from wpa_driver_wext_init()
bssid Buffer for BSSID
Returns:
0 on success, -1 on failure

Definition at line 95 of file driver_wext.c.

int wpa_driver_wext_get_ifflags struct wpa_driver_wext_data *  drv,
int *  flags
 

Get interface flags (SIOCGIFFLAGS).

Parameters:
drv driver_wext private data
flags Pointer to returned flags value
Returns:
0 on success, -1 on failure

Definition at line 695 of file driver_wext.c.

int wpa_driver_wext_get_scan_results void *  priv,
struct wpa_scan_result results,
size_t  max_size
 

Fetch the latest scan results.

Parameters:
priv Pointer to private wext data from wpa_driver_wext_init()
results Pointer to buffer for scan results
max_size Maximum number of entries (buffer size)
Returns:
Number of scan result entries used on success, -1 on failure
If scan results include more than max_size BSSes, max_size will be returned and the remaining entries will not be included in the buffer.

Definition at line 969 of file driver_wext.c.

Here is the call graph for this function:

int wpa_driver_wext_get_ssid void *  priv,
u8 *  ssid
 

Get SSID, SIOCGIWESSID.

Parameters:
priv Pointer to private wext data from wpa_driver_wext_init()
ssid Buffer for the SSID; must be at least 32 bytes long
Returns:
SSID length on success, -1 on failure

Definition at line 151 of file driver_wext.c.

void* wpa_driver_wext_init void *  ctx,
const char *  ifname
 

Initialize WE driver interface.

Parameters:
ctx context to be used when calling wpa_supplicant functions, e.g., wpa_supplicant_event()
ifname interface name, e.g., wlan0
Returns:
Pointer to private data, NULL on failure

Definition at line 740 of file driver_wext.c.

Here is the call graph for this function:

int wpa_driver_wext_scan void *  priv,
const u8 *  ssid,
size_t  ssid_len
 

Request the driver to initiate scan.

Parameters:
priv Pointer to private wext data from wpa_driver_wext_init()
ssid Specific SSID to scan for (ProbeReq) or NULL to scan for all SSIDs (either active scan with broadcast SSID or passive scan
ssid_len Length of the SSID
Returns:
0 on success, -1 on failure

Definition at line 877 of file driver_wext.c.

Here is the call graph for this function:

void wpa_driver_wext_scan_timeout void *  eloop_ctx,
void *  timeout_ctx
 

Scan timeout to report scan completion.

Parameters:
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.

Definition at line 860 of file driver_wext.c.

Here is the call graph for this function:

int wpa_driver_wext_set_bssid void *  priv,
const u8 *  bssid
 

Set BSSID, SIOCSIWAP.

Parameters:
priv Pointer to private wext data from wpa_driver_wext_init()
bssid BSSID
Returns:
0 on success, -1 on failure

Definition at line 121 of file driver_wext.c.

int wpa_driver_wext_set_freq void *  priv,
int  freq
 

Set frequency/channel, SIOCSIWFREQ.

Parameters:
priv Pointer to private wext data from wpa_driver_wext_init()
freq Frequency in MHz
Returns:
0 on success, -1 on failure

Definition at line 237 of file driver_wext.c.

int wpa_driver_wext_set_ifflags struct wpa_driver_wext_data *  drv,
int  flags
 

Set interface flags (SIOCSIFFLAGS).

Parameters:
drv driver_wext private data
flags New value for flags
Returns:
0 on success, -1 on failure

Definition at line 717 of file driver_wext.c.

int wpa_driver_wext_set_key void *  priv,
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.

Parameters:
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)
Returns:
0 on success, -1 on failure
This function uses SIOCSIWENCODEEXT by default, but tries to use SIOCSIWENCODE if the extended ioctl fails when configuring a WEP key.

Definition at line 1410 of file driver_wext.c.

Here is the call graph for this function:

int wpa_driver_wext_set_mode void *  priv,
int  mode
 

Set wireless mode (infra/adhoc), SIOCSIWMODE.

Parameters:
priv Pointer to private wext data from wpa_driver_wext_init()
mode 0 = infra/BSS (associate with an AP), 1 = adhoc/IBSS
Returns:
0 on success, -1 on failure

Definition at line 1748 of file driver_wext.c.

int wpa_driver_wext_set_ssid void *  priv,
const u8 *  ssid,
size_t  ssid_len
 

Set SSID, SIOCSIWESSID.

Parameters:
priv Pointer to private wext data from wpa_driver_wext_init()
ssid SSID
ssid_len Length of SSID (0..32)
Returns:
0 on success, -1 on failure

Definition at line 190 of file driver_wext.c.


Variable Documentation

const struct wpa_driver_ops wpa_driver_wext_ops
 

Initial value:

 {
        .name = "wext",
        .desc = "Linux wireless extensions (generic)",
        .get_bssid = wpa_driver_wext_get_bssid,
        .get_ssid = wpa_driver_wext_get_ssid,
        .set_wpa = wpa_driver_wext_set_wpa,
        .set_key = wpa_driver_wext_set_key,
        .set_countermeasures = wpa_driver_wext_set_countermeasures,
        .set_drop_unencrypted = wpa_driver_wext_set_drop_unencrypted,
        .scan = wpa_driver_wext_scan,
        .get_scan_results = wpa_driver_wext_get_scan_results,
        .deauthenticate = wpa_driver_wext_deauthenticate,
        .disassociate = wpa_driver_wext_disassociate,
        .associate = wpa_driver_wext_associate,
        .set_auth_alg = wpa_driver_wext_set_auth_alg,
        .init = wpa_driver_wext_init,
        .deinit = wpa_driver_wext_deinit,
        .add_pmkid = wpa_driver_wext_add_pmkid,
        .remove_pmkid = wpa_driver_wext_remove_pmkid,
        .flush_pmkid = wpa_driver_wext_flush_pmkid,
        .get_capa = wpa_driver_wext_get_capa,
}

Definition at line 1848 of file driver_wext.c.


Generated on Sat May 6 21:15:06 2006 for wpa_supplicant by  doxygen 1.4.2