Add preliminary hostapd data structure initialization for AP mode

wpa_supplicant can now initialize hostapd data structures when mode=2 is
used to set up an AP. The hostapd configuration is not yet set based on
wpa_supplicant network configuration block. In addition, the glue code
for hostapd driver_ops needs number of functions that will be needed for
AP functionality.
This commit is contained in:
Jouni Malinen 2009-03-26 20:37:05 +02:00 committed by Jouni Malinen
parent 89111f3bbc
commit 2d5b792d2b
16 changed files with 529 additions and 479 deletions

View File

@ -627,6 +627,9 @@ OBJS += ap.o
CFLAGS += -DCONFIG_NO_RADIUS
CFLAGS += -DCONFIG_NO_ACCOUNTING
CFLAGS += -DCONFIG_NO_VLAN
OBJS += ../hostapd/hostapd.o
OBJS += ../hostapd/config.o
OBJS += ../src/utils/ip_addr.o
OBJS += ../hostapd/sta_info.o
OBJS += ../hostapd/wpa.o
OBJS += ../hostapd/pmksa_cache.o

View File

@ -18,65 +18,14 @@
#include "common.h"
#include "../hostapd/hostapd.h"
#include "../hostapd/config.h"
#include "../hostapd/driver.h"
#include "eap_common/eap_defs.h"
#include "eap_server/eap_methods.h"
#include "eap_common/eap_wsc_common.h"
#include "config_ssid.h"
#include "wpa_supplicant_i.h"
int hostapd_reload_config(struct hostapd_iface *iface)
{
/* TODO */
return -1;
}
int hostapd_maclist_found(struct mac_acl_entry *list, int num_entries,
const u8 *addr, int *vlan_id)
{
int start, end, middle, res;
start = 0;
end = num_entries - 1;
while (start <= end) {
middle = (start + end) / 2;
res = os_memcmp(list[middle].addr, addr, ETH_ALEN);
if (res == 0) {
if (vlan_id)
*vlan_id = list[middle].vlan_id;
return 1;
}
if (res < 0)
start = middle + 1;
else
end = middle - 1;
}
return 0;
}
int hostapd_rate_found(int *list, int rate)
{
int i;
if (list == NULL)
return 0;
for (i = 0; list[i] >= 0; i++)
if (list[i] == rate)
return 1;
return 0;
}
const char * hostapd_get_vlan_id_ifname(struct hostapd_vlan *vlan, int vlan_id)
{
return NULL;
}
#include "driver_i.h"
#include "ap.h"
int hostapd_for_each_interface(int (*cb)(struct hostapd_iface *iface,
@ -87,68 +36,113 @@ int hostapd_for_each_interface(int (*cb)(struct hostapd_iface *iface,
}
const struct hostapd_eap_user *
hostapd_get_eap_user(const struct hostapd_bss_config *conf, const u8 *identity,
size_t identity_len, int phase2)
int hostapd_ctrl_iface_init(struct hostapd_data *hapd)
{
struct hostapd_eap_user *user = conf->eap_user;
#ifdef CONFIG_WPS
if (conf->wps_state && identity_len == WSC_ID_ENROLLEE_LEN &&
os_memcmp(identity, WSC_ID_ENROLLEE, WSC_ID_ENROLLEE_LEN) == 0) {
static struct hostapd_eap_user wsc_enrollee;
os_memset(&wsc_enrollee, 0, sizeof(wsc_enrollee));
wsc_enrollee.methods[0].method = eap_server_get_type(
"WSC", &wsc_enrollee.methods[0].vendor);
return &wsc_enrollee;
}
if (conf->wps_state && conf->ap_pin &&
identity_len == WSC_ID_REGISTRAR_LEN &&
os_memcmp(identity, WSC_ID_REGISTRAR, WSC_ID_REGISTRAR_LEN) == 0) {
static struct hostapd_eap_user wsc_registrar;
os_memset(&wsc_registrar, 0, sizeof(wsc_registrar));
wsc_registrar.methods[0].method = eap_server_get_type(
"WSC", &wsc_registrar.methods[0].vendor);
wsc_registrar.password = (u8 *) conf->ap_pin;
wsc_registrar.password_len = os_strlen(conf->ap_pin);
return &wsc_registrar;
}
#endif /* CONFIG_WPS */
while (user) {
if (!phase2 && user->identity == NULL) {
/* Wildcard match */
break;
}
if (user->phase2 == !!phase2 && user->wildcard_prefix &&
identity_len >= user->identity_len &&
os_memcmp(user->identity, identity, user->identity_len) ==
0) {
/* Wildcard prefix match */
break;
}
if (user->phase2 == !!phase2 &&
user->identity_len == identity_len &&
os_memcmp(user->identity, identity, identity_len) == 0)
break;
user = user->next;
}
return user;
return 0;
}
void wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid)
void hostapd_ctrl_iface_deinit(struct hostapd_data *hapd)
{
}
struct ap_driver_data {
struct hostapd_data *hapd;
};
static void * ap_driver_init(struct hostapd_data *hapd)
{
struct ap_driver_data *drv;
drv = os_zalloc(sizeof(struct ap_driver_data));
if (drv == NULL) {
wpa_printf(MSG_ERROR, "Could not allocate memory for AP "
"driver data");
return NULL;
}
drv->hapd = hapd;
return drv;
}
static void ap_driver_deinit(void *priv)
{
struct ap_driver_data *drv = priv;
os_free(drv);
}
static int ap_driver_send_ether(void *priv, const u8 *dst, const u8 *src,
u16 proto, const u8 *data, size_t data_len)
{
return 0;
}
static struct hapd_driver_ops ap_driver_ops =
{
.name = "wpa_supplicant",
.init = ap_driver_init,
.deinit = ap_driver_deinit,
.send_ether = ap_driver_send_ether,
};
struct hapd_driver_ops *hostapd_drivers[] =
{
&ap_driver_ops,
NULL
};
int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid)
{
struct wpa_driver_associate_params params;
struct hostapd_iface *hapd_iface;
struct hostapd_config *conf;
size_t i;
if (ssid->ssid == NULL || ssid->ssid_len == 0) {
wpa_printf(MSG_ERROR, "No SSID configured for AP mode");
return;
return -1;
}
wpa_supplicant_ap_deinit(wpa_s);
wpa_s->ap_iface = hapd_iface = os_zalloc(sizeof(*wpa_s->ap_iface));
if (hapd_iface == NULL)
return -1;
wpa_s->ap_iface->conf = conf = hostapd_config_defaults();
if (conf == NULL) {
wpa_supplicant_ap_deinit(wpa_s);
return -1;
}
hapd_iface->num_bss = conf->num_bss;
hapd_iface->bss = os_zalloc(conf->num_bss *
sizeof(struct hostapd_data *));
if (hapd_iface->bss == NULL) {
wpa_supplicant_ap_deinit(wpa_s);
return -1;
}
for (i = 0; i < conf->num_bss; i++) {
hapd_iface->bss[i] =
hostapd_alloc_bss_data(hapd_iface, conf,
&conf->bss[i]);
if (hapd_iface->bss[i] == NULL) {
wpa_supplicant_ap_deinit(wpa_s);
return -1;
}
}
if (hostapd_setup_interface(wpa_s->ap_iface)) {
wpa_printf(MSG_ERROR, "Failed to initialize AP interface");
wpa_supplicant_ap_deinit(wpa_s);
return -1;
}
wpa_printf(MSG_DEBUG, "Setting up AP (SSID='%s')",
@ -159,6 +153,20 @@ void wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
params.ssid_len = ssid->ssid_len;
params.mode = ssid->mode;
if (wpa_drv_associate(wpa_s, &params) < 0)
if (wpa_drv_associate(wpa_s, &params) < 0) {
wpa_msg(wpa_s, MSG_INFO, "Failed to start AP functionality");
return -1;
}
return 0;
}
void wpa_supplicant_ap_deinit(struct wpa_supplicant *wpa_s)
{
if (wpa_s->ap_iface == NULL)
return;
hostapd_interface_deinit(wpa_s->ap_iface);
wpa_s->ap_iface = NULL;
}

View File

@ -16,7 +16,8 @@
#ifndef AP_H
#define AP_H
void wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid);
int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid);
void wpa_supplicant_ap_deinit(struct wpa_supplicant *wpa_s);
#endif /* AP_H */

View File

@ -20,6 +20,7 @@
#include "config.h"
#include "eapol_supp/eapol_supp_sm.h"
#include "wpa_supplicant_i.h"
#include "driver_i.h"
#include "ctrl_iface.h"
#include "l2_packet/l2_packet.h"
#include "preauth.h"
@ -31,6 +32,8 @@
#include "wps/wps.h"
#include "ibss_rsn.h"
extern struct wpa_driver_ops *wpa_supplicant_drivers[];
static int wpa_supplicant_global_iface_list(struct wpa_global *global,
char *buf, int len);
static int wpa_supplicant_global_iface_interfaces(struct wpa_global *global,

View File

@ -18,6 +18,7 @@
#include "eloop.h"
#include "config.h"
#include "wpa_supplicant_i.h"
#include "drivers/driver.h"
#include "wps/wps.h"
#include "ctrl_iface_dbus.h"
#include "ctrl_iface_dbus_handlers.h"

View File

@ -17,6 +17,7 @@
#include "common.h"
#include "config.h"
#include "wpa_supplicant_i.h"
#include "driver_i.h"
#include "ctrl_iface_dbus.h"
#include "ctrl_iface_dbus_handlers.h"
#include "eap_peer/eap_methods.h"

381
wpa_supplicant/driver_i.h Normal file
View File

@ -0,0 +1,381 @@
/*
* wpa_supplicant - Internal driver interface wrappers
* Copyright (c) 2003-2009, Jouni Malinen <j@w1.fi>
*
* 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.
*/
#ifndef DRIVER_I_H
#define DRIVER_I_H
#include "drivers/driver.h"
/* driver_ops */
static inline void * wpa_drv_init(struct wpa_supplicant *wpa_s,
const char *ifname)
{
if (wpa_s->driver->init2)
return wpa_s->driver->init2(wpa_s, ifname, wpa_s->global);
if (wpa_s->driver->init) {
return wpa_s->driver->init(wpa_s, ifname);
}
return NULL;
}
static inline void wpa_drv_deinit(struct wpa_supplicant *wpa_s)
{
if (wpa_s->driver->deinit)
wpa_s->driver->deinit(wpa_s->drv_priv);
}
static inline int wpa_drv_set_param(struct wpa_supplicant *wpa_s,
const char *param)
{
if (wpa_s->driver->set_param)
return wpa_s->driver->set_param(wpa_s->drv_priv, param);
return 0;
}
static inline int wpa_drv_set_drop_unencrypted(struct wpa_supplicant *wpa_s,
int enabled)
{
if (wpa_s->driver->set_drop_unencrypted) {
return wpa_s->driver->set_drop_unencrypted(wpa_s->drv_priv,
enabled);
}
return -1;
}
static inline int wpa_drv_set_countermeasures(struct wpa_supplicant *wpa_s,
int enabled)
{
if (wpa_s->driver->set_countermeasures) {
return wpa_s->driver->set_countermeasures(wpa_s->drv_priv,
enabled);
}
return -1;
}
static inline int wpa_drv_set_auth_alg(struct wpa_supplicant *wpa_s,
int auth_alg)
{
if (wpa_s->driver->set_auth_alg) {
return wpa_s->driver->set_auth_alg(wpa_s->drv_priv,
auth_alg);
}
return -1;
}
static inline int wpa_drv_set_wpa(struct wpa_supplicant *wpa_s, int enabled)
{
if (wpa_s->driver->set_wpa) {
return wpa_s->driver->set_wpa(wpa_s->drv_priv, enabled);
}
return 0;
}
static inline int wpa_drv_set_mode(struct wpa_supplicant *wpa_s, int mode)
{
if (wpa_s->driver->set_mode) {
return wpa_s->driver->set_mode(wpa_s->drv_priv, mode);
}
return 0;
}
static inline int wpa_drv_authenticate(struct wpa_supplicant *wpa_s,
struct wpa_driver_auth_params *params)
{
if (wpa_s->driver->authenticate)
return wpa_s->driver->authenticate(wpa_s->drv_priv, params);
return -1;
}
static inline int wpa_drv_associate(struct wpa_supplicant *wpa_s,
struct wpa_driver_associate_params *params)
{
if (wpa_s->driver->associate) {
return wpa_s->driver->associate(wpa_s->drv_priv, params);
}
return -1;
}
static inline int wpa_drv_scan(struct wpa_supplicant *wpa_s,
struct wpa_driver_scan_params *params)
{
if (wpa_s->driver->scan2)
return wpa_s->driver->scan2(wpa_s->drv_priv, params);
if (wpa_s->driver->scan)
return wpa_s->driver->scan(wpa_s->drv_priv,
params->ssids[0].ssid,
params->ssids[0].ssid_len);
return -1;
}
static inline int wpa_drv_get_scan_results(struct wpa_supplicant *wpa_s,
struct wpa_scan_result *results,
size_t max_size)
{
if (wpa_s->driver->get_scan_results) {
return wpa_s->driver->get_scan_results(wpa_s->drv_priv,
results, max_size);
}
return -1;
}
static inline struct wpa_scan_results * wpa_drv_get_scan_results2(
struct wpa_supplicant *wpa_s)
{
if (wpa_s->driver->get_scan_results2)
return wpa_s->driver->get_scan_results2(wpa_s->drv_priv);
return NULL;
}
static inline int wpa_drv_get_bssid(struct wpa_supplicant *wpa_s, u8 *bssid)
{
if (wpa_s->driver->get_bssid) {
return wpa_s->driver->get_bssid(wpa_s->drv_priv, bssid);
}
return -1;
}
static inline int wpa_drv_get_ssid(struct wpa_supplicant *wpa_s, u8 *ssid)
{
if (wpa_s->driver->get_ssid) {
return wpa_s->driver->get_ssid(wpa_s->drv_priv, ssid);
}
return -1;
}
static inline int wpa_drv_set_key(struct wpa_supplicant *wpa_s, 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)
{
if (wpa_s->driver->set_key) {
wpa_s->keys_cleared = 0;
return wpa_s->driver->set_key(wpa_s->drv_priv, alg, addr,
key_idx, set_tx, seq, seq_len,
key, key_len);
}
return -1;
}
static inline int wpa_drv_deauthenticate(struct wpa_supplicant *wpa_s,
const u8 *addr, int reason_code)
{
if (wpa_s->driver->deauthenticate) {
return wpa_s->driver->deauthenticate(wpa_s->drv_priv, addr,
reason_code);
}
return -1;
}
static inline int wpa_drv_disassociate(struct wpa_supplicant *wpa_s,
const u8 *addr, int reason_code)
{
if (wpa_s->driver->disassociate) {
return wpa_s->driver->disassociate(wpa_s->drv_priv, addr,
reason_code);
}
return -1;
}
static inline int wpa_drv_add_pmkid(struct wpa_supplicant *wpa_s,
const u8 *bssid, const u8 *pmkid)
{
if (wpa_s->driver->add_pmkid) {
return wpa_s->driver->add_pmkid(wpa_s->drv_priv, bssid, pmkid);
}
return -1;
}
static inline int wpa_drv_remove_pmkid(struct wpa_supplicant *wpa_s,
const u8 *bssid, const u8 *pmkid)
{
if (wpa_s->driver->remove_pmkid) {
return wpa_s->driver->remove_pmkid(wpa_s->drv_priv, bssid,
pmkid);
}
return -1;
}
static inline int wpa_drv_flush_pmkid(struct wpa_supplicant *wpa_s)
{
if (wpa_s->driver->flush_pmkid) {
return wpa_s->driver->flush_pmkid(wpa_s->drv_priv);
}
return -1;
}
static inline int wpa_drv_get_capa(struct wpa_supplicant *wpa_s,
struct wpa_driver_capa *capa)
{
if (wpa_s->driver->get_capa) {
return wpa_s->driver->get_capa(wpa_s->drv_priv, capa);
}
return -1;
}
static inline void wpa_drv_poll(struct wpa_supplicant *wpa_s)
{
if (wpa_s->driver->poll) {
wpa_s->driver->poll(wpa_s->drv_priv);
}
}
static inline const char * wpa_drv_get_ifname(struct wpa_supplicant *wpa_s)
{
if (wpa_s->driver->get_ifname) {
return wpa_s->driver->get_ifname(wpa_s->drv_priv);
}
return NULL;
}
static inline const u8 * wpa_drv_get_mac_addr(struct wpa_supplicant *wpa_s)
{
if (wpa_s->driver->get_mac_addr) {
return wpa_s->driver->get_mac_addr(wpa_s->drv_priv);
}
return NULL;
}
static inline int wpa_drv_send_eapol(struct wpa_supplicant *wpa_s,
const u8 *dst, u16 proto,
const u8 *data, size_t data_len)
{
if (wpa_s->driver->send_eapol)
return wpa_s->driver->send_eapol(wpa_s->drv_priv, dst, proto,
data, data_len);
return -1;
}
static inline int wpa_drv_set_operstate(struct wpa_supplicant *wpa_s,
int state)
{
if (wpa_s->driver->set_operstate)
return wpa_s->driver->set_operstate(wpa_s->drv_priv, state);
return 0;
}
static inline int wpa_drv_mlme_setprotection(struct wpa_supplicant *wpa_s,
const u8 *addr, int protect_type,
int key_type)
{
if (wpa_s->driver->mlme_setprotection)
return wpa_s->driver->mlme_setprotection(wpa_s->drv_priv, addr,
protect_type,
key_type);
return 0;
}
static inline struct wpa_hw_modes *
wpa_drv_get_hw_feature_data(struct wpa_supplicant *wpa_s, u16 *num_modes,
u16 *flags)
{
if (wpa_s->driver->get_hw_feature_data)
return wpa_s->driver->get_hw_feature_data(wpa_s->drv_priv,
num_modes, flags);
return NULL;
}
static inline int wpa_drv_set_channel(struct wpa_supplicant *wpa_s,
wpa_hw_mode phymode, int chan,
int freq)
{
if (wpa_s->driver->set_channel)
return wpa_s->driver->set_channel(wpa_s->drv_priv, phymode,
chan, freq);
return -1;
}
static inline int wpa_drv_set_ssid(struct wpa_supplicant *wpa_s,
const u8 *ssid, size_t ssid_len)
{
if (wpa_s->driver->set_ssid) {
return wpa_s->driver->set_ssid(wpa_s->drv_priv, ssid,
ssid_len);
}
return -1;
}
static inline int wpa_drv_set_bssid(struct wpa_supplicant *wpa_s,
const u8 *bssid)
{
if (wpa_s->driver->set_bssid) {
return wpa_s->driver->set_bssid(wpa_s->drv_priv, bssid);
}
return -1;
}
static inline int wpa_drv_set_country(struct wpa_supplicant *wpa_s,
const char *alpha2)
{
if (wpa_s->driver->set_country)
return wpa_s->driver->set_country(wpa_s->drv_priv, alpha2);
return 0;
}
static inline int wpa_drv_send_mlme(struct wpa_supplicant *wpa_s,
const u8 *data, size_t data_len)
{
if (wpa_s->driver->send_mlme)
return wpa_s->driver->send_mlme(wpa_s->drv_priv,
data, data_len);
return -1;
}
static inline int wpa_drv_mlme_add_sta(struct wpa_supplicant *wpa_s,
const u8 *addr, const u8 *supp_rates,
size_t supp_rates_len)
{
if (wpa_s->driver->mlme_add_sta)
return wpa_s->driver->mlme_add_sta(wpa_s->drv_priv, addr,
supp_rates, supp_rates_len);
return -1;
}
static inline int wpa_drv_mlme_remove_sta(struct wpa_supplicant *wpa_s,
const u8 *addr)
{
if (wpa_s->driver->mlme_remove_sta)
return wpa_s->driver->mlme_remove_sta(wpa_s->drv_priv, addr);
return -1;
}
static inline int wpa_drv_update_ft_ies(struct wpa_supplicant *wpa_s,
const u8 *md,
const u8 *ies, size_t ies_len)
{
if (wpa_s->driver->update_ft_ies)
return wpa_s->driver->update_ft_ies(wpa_s->drv_priv, md,
ies, ies_len);
return -1;
}
static inline int wpa_drv_send_ft_action(struct wpa_supplicant *wpa_s,
u8 action, const u8 *target_ap,
const u8 *ies, size_t ies_len)
{
if (wpa_s->driver->send_ft_action)
return wpa_s->driver->send_ft_action(wpa_s->drv_priv, action,
target_ap, ies, ies_len);
return -1;
}
static inline int wpa_drv_set_probe_req_ie(struct wpa_supplicant *wpa_s,
const u8 *ies, size_t ies_len)
{
if (wpa_s->driver->set_probe_req_ie)
return wpa_s->driver->set_probe_req_ie(wpa_s->drv_priv, ies,
ies_len);
return -1;
}
#endif /* DRIVER_I_H */

View File

@ -18,10 +18,10 @@
#include "eapol_supp/eapol_supp_sm.h"
#include "wpa.h"
#include "eloop.h"
#include "drivers/driver.h"
#include "config.h"
#include "l2_packet/l2_packet.h"
#include "wpa_supplicant_i.h"
#include "driver_i.h"
#include "pcsc_funcs.h"
#include "preauth.h"
#include "pmksa_cache.h"

View File

@ -19,6 +19,9 @@
#include "common.h"
#include "wpa_supplicant_i.h"
#include "driver_i.h"
extern struct wpa_driver_ops *wpa_supplicant_drivers[];
static void usage(void)

View File

@ -20,8 +20,8 @@
#include "eloop.h"
#include "config_ssid.h"
#include "wpa_supplicant_i.h"
#include "driver_i.h"
#include "wpa.h"
#include "drivers/driver.h"
#include "ieee802_11_defs.h"
#include "ieee802_11_common.h"
#include "mlme.h"

View File

@ -18,6 +18,7 @@
#include "eloop.h"
#include "config.h"
#include "wpa_supplicant_i.h"
#include "driver_i.h"
#include "mlme.h"
#include "wps_supplicant.h"

View File

@ -15,7 +15,6 @@
#include "includes.h"
#include "common.h"
#include "drivers/driver.h"
#include "ieee802_11_defs.h"
#include "eapol_supp/eapol_supp_sm.h"
#include "wpa_common.h"
@ -23,6 +22,7 @@
#include "pmksa_cache.h"
#include "config.h"
#include "wpa_supplicant_i.h"
#include "driver_i.h"
#include "wpas_glue.h"
#include "wps_supplicant.h"
#include "sme.h"

View File

@ -23,10 +23,10 @@
#include "eap_peer/eap.h"
#include "wpa.h"
#include "eloop.h"
#include "drivers/driver.h"
#include "config.h"
#include "l2_packet/l2_packet.h"
#include "wpa_supplicant_i.h"
#include "driver_i.h"
#include "ctrl_iface.h"
#include "ctrl_iface_dbus.h"
#include "pcsc_funcs.h"
@ -114,6 +114,7 @@ const char *wpa_supplicant_full_license5 =
extern int wpa_debug_level;
extern int wpa_debug_show_keys;
extern int wpa_debug_timestamp;
extern struct wpa_driver_ops *wpa_supplicant_drivers[];
/* Configure default/group WEP keys for static WEP */
static int wpa_set_wep_keys(struct wpa_supplicant *wpa_s,
@ -413,6 +414,10 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s)
wpa_s->sme.ft_ies = NULL;
wpa_s->sme.ft_ies_len = 0;
#endif /* CONFIG_SME */
#ifdef CONFIG_AP
wpa_supplicant_ap_deinit(wpa_s);
#endif /* CONFIG_AP */
}

View File

@ -15,7 +15,7 @@
#ifndef WPA_SUPPLICANT_I_H
#define WPA_SUPPLICANT_I_H
#include "drivers/driver.h"
#include "common/defs.h"
extern const char *wpa_supplicant_version;
extern const char *wpa_supplicant_license;
@ -27,10 +27,8 @@ extern const char *wpa_supplicant_full_license4;
extern const char *wpa_supplicant_full_license5;
#endif /* CONFIG_NO_STDOUT_DEBUG */
extern struct wpa_driver_ops *wpa_supplicant_drivers[];
struct wpa_scan_result;
struct wpa_scan_res;
struct wpa_sm;
struct wpa_supplicant;
struct ibss_rsn;
@ -381,6 +379,10 @@ struct wpa_supplicant {
size_t ft_ies_len;
} sme;
#endif /* CONFIG_SME */
#ifdef CONFIG_AP
struct hostapd_iface *ap_iface;
#endif /* CONFIG_AP */
};
@ -433,365 +435,4 @@ void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s);
/* events.c */
void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
/* driver_ops */
static inline void * wpa_drv_init(struct wpa_supplicant *wpa_s,
const char *ifname)
{
if (wpa_s->driver->init2)
return wpa_s->driver->init2(wpa_s, ifname, wpa_s->global);
if (wpa_s->driver->init) {
return wpa_s->driver->init(wpa_s, ifname);
}
return NULL;
}
static inline void wpa_drv_deinit(struct wpa_supplicant *wpa_s)
{
if (wpa_s->driver->deinit)
wpa_s->driver->deinit(wpa_s->drv_priv);
}
static inline int wpa_drv_set_param(struct wpa_supplicant *wpa_s,
const char *param)
{
if (wpa_s->driver->set_param)
return wpa_s->driver->set_param(wpa_s->drv_priv, param);
return 0;
}
static inline int wpa_drv_set_drop_unencrypted(struct wpa_supplicant *wpa_s,
int enabled)
{
if (wpa_s->driver->set_drop_unencrypted) {
return wpa_s->driver->set_drop_unencrypted(wpa_s->drv_priv,
enabled);
}
return -1;
}
static inline int wpa_drv_set_countermeasures(struct wpa_supplicant *wpa_s,
int enabled)
{
if (wpa_s->driver->set_countermeasures) {
return wpa_s->driver->set_countermeasures(wpa_s->drv_priv,
enabled);
}
return -1;
}
static inline int wpa_drv_set_auth_alg(struct wpa_supplicant *wpa_s,
int auth_alg)
{
if (wpa_s->driver->set_auth_alg) {
return wpa_s->driver->set_auth_alg(wpa_s->drv_priv,
auth_alg);
}
return -1;
}
static inline int wpa_drv_set_wpa(struct wpa_supplicant *wpa_s, int enabled)
{
if (wpa_s->driver->set_wpa) {
return wpa_s->driver->set_wpa(wpa_s->drv_priv, enabled);
}
return 0;
}
static inline int wpa_drv_set_mode(struct wpa_supplicant *wpa_s, int mode)
{
if (wpa_s->driver->set_mode) {
return wpa_s->driver->set_mode(wpa_s->drv_priv, mode);
}
return 0;
}
static inline int wpa_drv_authenticate(struct wpa_supplicant *wpa_s,
struct wpa_driver_auth_params *params)
{
if (wpa_s->driver->authenticate)
return wpa_s->driver->authenticate(wpa_s->drv_priv, params);
return -1;
}
static inline int wpa_drv_associate(struct wpa_supplicant *wpa_s,
struct wpa_driver_associate_params *params)
{
if (wpa_s->driver->associate) {
return wpa_s->driver->associate(wpa_s->drv_priv, params);
}
return -1;
}
static inline int wpa_drv_scan(struct wpa_supplicant *wpa_s,
struct wpa_driver_scan_params *params)
{
if (wpa_s->driver->scan2)
return wpa_s->driver->scan2(wpa_s->drv_priv, params);
if (wpa_s->driver->scan)
return wpa_s->driver->scan(wpa_s->drv_priv,
params->ssids[0].ssid,
params->ssids[0].ssid_len);
return -1;
}
static inline int wpa_drv_get_scan_results(struct wpa_supplicant *wpa_s,
struct wpa_scan_result *results,
size_t max_size)
{
if (wpa_s->driver->get_scan_results) {
return wpa_s->driver->get_scan_results(wpa_s->drv_priv,
results, max_size);
}
return -1;
}
static inline struct wpa_scan_results * wpa_drv_get_scan_results2(
struct wpa_supplicant *wpa_s)
{
if (wpa_s->driver->get_scan_results2)
return wpa_s->driver->get_scan_results2(wpa_s->drv_priv);
return NULL;
}
static inline int wpa_drv_get_bssid(struct wpa_supplicant *wpa_s, u8 *bssid)
{
if (wpa_s->driver->get_bssid) {
return wpa_s->driver->get_bssid(wpa_s->drv_priv, bssid);
}
return -1;
}
static inline int wpa_drv_get_ssid(struct wpa_supplicant *wpa_s, u8 *ssid)
{
if (wpa_s->driver->get_ssid) {
return wpa_s->driver->get_ssid(wpa_s->drv_priv, ssid);
}
return -1;
}
static inline int wpa_drv_set_key(struct wpa_supplicant *wpa_s, 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)
{
if (wpa_s->driver->set_key) {
wpa_s->keys_cleared = 0;
return wpa_s->driver->set_key(wpa_s->drv_priv, alg, addr,
key_idx, set_tx, seq, seq_len,
key, key_len);
}
return -1;
}
static inline int wpa_drv_deauthenticate(struct wpa_supplicant *wpa_s,
const u8 *addr, int reason_code)
{
if (wpa_s->driver->deauthenticate) {
return wpa_s->driver->deauthenticate(wpa_s->drv_priv, addr,
reason_code);
}
return -1;
}
static inline int wpa_drv_disassociate(struct wpa_supplicant *wpa_s,
const u8 *addr, int reason_code)
{
if (wpa_s->driver->disassociate) {
return wpa_s->driver->disassociate(wpa_s->drv_priv, addr,
reason_code);
}
return -1;
}
static inline int wpa_drv_add_pmkid(struct wpa_supplicant *wpa_s,
const u8 *bssid, const u8 *pmkid)
{
if (wpa_s->driver->add_pmkid) {
return wpa_s->driver->add_pmkid(wpa_s->drv_priv, bssid, pmkid);
}
return -1;
}
static inline int wpa_drv_remove_pmkid(struct wpa_supplicant *wpa_s,
const u8 *bssid, const u8 *pmkid)
{
if (wpa_s->driver->remove_pmkid) {
return wpa_s->driver->remove_pmkid(wpa_s->drv_priv, bssid,
pmkid);
}
return -1;
}
static inline int wpa_drv_flush_pmkid(struct wpa_supplicant *wpa_s)
{
if (wpa_s->driver->flush_pmkid) {
return wpa_s->driver->flush_pmkid(wpa_s->drv_priv);
}
return -1;
}
static inline int wpa_drv_get_capa(struct wpa_supplicant *wpa_s,
struct wpa_driver_capa *capa)
{
if (wpa_s->driver->get_capa) {
return wpa_s->driver->get_capa(wpa_s->drv_priv, capa);
}
return -1;
}
static inline void wpa_drv_poll(struct wpa_supplicant *wpa_s)
{
if (wpa_s->driver->poll) {
wpa_s->driver->poll(wpa_s->drv_priv);
}
}
static inline const char * wpa_drv_get_ifname(struct wpa_supplicant *wpa_s)
{
if (wpa_s->driver->get_ifname) {
return wpa_s->driver->get_ifname(wpa_s->drv_priv);
}
return NULL;
}
static inline const u8 * wpa_drv_get_mac_addr(struct wpa_supplicant *wpa_s)
{
if (wpa_s->driver->get_mac_addr) {
return wpa_s->driver->get_mac_addr(wpa_s->drv_priv);
}
return NULL;
}
static inline int wpa_drv_send_eapol(struct wpa_supplicant *wpa_s,
const u8 *dst, u16 proto,
const u8 *data, size_t data_len)
{
if (wpa_s->driver->send_eapol)
return wpa_s->driver->send_eapol(wpa_s->drv_priv, dst, proto,
data, data_len);
return -1;
}
static inline int wpa_drv_set_operstate(struct wpa_supplicant *wpa_s,
int state)
{
if (wpa_s->driver->set_operstate)
return wpa_s->driver->set_operstate(wpa_s->drv_priv, state);
return 0;
}
static inline int wpa_drv_mlme_setprotection(struct wpa_supplicant *wpa_s,
const u8 *addr, int protect_type,
int key_type)
{
if (wpa_s->driver->mlme_setprotection)
return wpa_s->driver->mlme_setprotection(wpa_s->drv_priv, addr,
protect_type,
key_type);
return 0;
}
static inline struct wpa_hw_modes *
wpa_drv_get_hw_feature_data(struct wpa_supplicant *wpa_s, u16 *num_modes,
u16 *flags)
{
if (wpa_s->driver->get_hw_feature_data)
return wpa_s->driver->get_hw_feature_data(wpa_s->drv_priv,
num_modes, flags);
return NULL;
}
static inline int wpa_drv_set_channel(struct wpa_supplicant *wpa_s,
wpa_hw_mode phymode, int chan,
int freq)
{
if (wpa_s->driver->set_channel)
return wpa_s->driver->set_channel(wpa_s->drv_priv, phymode,
chan, freq);
return -1;
}
static inline int wpa_drv_set_ssid(struct wpa_supplicant *wpa_s,
const u8 *ssid, size_t ssid_len)
{
if (wpa_s->driver->set_ssid) {
return wpa_s->driver->set_ssid(wpa_s->drv_priv, ssid,
ssid_len);
}
return -1;
}
static inline int wpa_drv_set_bssid(struct wpa_supplicant *wpa_s,
const u8 *bssid)
{
if (wpa_s->driver->set_bssid) {
return wpa_s->driver->set_bssid(wpa_s->drv_priv, bssid);
}
return -1;
}
static inline int wpa_drv_set_country(struct wpa_supplicant *wpa_s,
const char *alpha2)
{
if (wpa_s->driver->set_country)
return wpa_s->driver->set_country(wpa_s->drv_priv, alpha2);
return 0;
}
static inline int wpa_drv_send_mlme(struct wpa_supplicant *wpa_s,
const u8 *data, size_t data_len)
{
if (wpa_s->driver->send_mlme)
return wpa_s->driver->send_mlme(wpa_s->drv_priv,
data, data_len);
return -1;
}
static inline int wpa_drv_mlme_add_sta(struct wpa_supplicant *wpa_s,
const u8 *addr, const u8 *supp_rates,
size_t supp_rates_len)
{
if (wpa_s->driver->mlme_add_sta)
return wpa_s->driver->mlme_add_sta(wpa_s->drv_priv, addr,
supp_rates, supp_rates_len);
return -1;
}
static inline int wpa_drv_mlme_remove_sta(struct wpa_supplicant *wpa_s,
const u8 *addr)
{
if (wpa_s->driver->mlme_remove_sta)
return wpa_s->driver->mlme_remove_sta(wpa_s->drv_priv, addr);
return -1;
}
static inline int wpa_drv_update_ft_ies(struct wpa_supplicant *wpa_s,
const u8 *md,
const u8 *ies, size_t ies_len)
{
if (wpa_s->driver->update_ft_ies)
return wpa_s->driver->update_ft_ies(wpa_s->drv_priv, md,
ies, ies_len);
return -1;
}
static inline int wpa_drv_send_ft_action(struct wpa_supplicant *wpa_s,
u8 action, const u8 *target_ap,
const u8 *ies, size_t ies_len)
{
if (wpa_s->driver->send_ft_action)
return wpa_s->driver->send_ft_action(wpa_s->drv_priv, action,
target_ap, ies, ies_len);
return -1;
}
static inline int wpa_drv_set_probe_req_ie(struct wpa_supplicant *wpa_s,
const u8 *ies, size_t ies_len)
{
if (wpa_s->driver->set_probe_req_ie)
return wpa_s->driver->set_probe_req_ie(wpa_s->drv_priv, ies,
ies_len);
return -1;
}
#endif /* WPA_SUPPLICANT_I_H */

View File

@ -22,6 +22,7 @@
#include "l2_packet/l2_packet.h"
#include "wpa_common.h"
#include "wpa_supplicant_i.h"
#include "driver_i.h"
#include "pmksa_cache.h"
#include "mlme.h"
#include "sme.h"

View File

@ -20,6 +20,7 @@
#include "config.h"
#include "eap_peer/eap.h"
#include "wpa_supplicant_i.h"
#include "driver_i.h"
#include "eloop.h"
#include "uuid.h"
#include "wpa_ctrl.h"