Remove deprecated driver_ops handlers

This gets rid of previously deprecated driver_ops handlers set_wpa,
set_drop_unencrypted, set_auth_alg, set_mode. The same functionality
can be achieved by using the init/deinit/associate handlers.
This commit is contained in:
Jouni Malinen 2009-11-23 20:22:38 +02:00 committed by Jouni Malinen
parent 331c12086f
commit 4a867032ae
20 changed files with 90 additions and 302 deletions

View file

@ -513,13 +513,6 @@ hostapd_set_wps_probe_resp_ie(struct hostapd_data *hapd, const u8 *ie,
hapd->drv_priv, ie, len);
}
static inline int hostapd_driver_set_mode(struct hostapd_data *hapd, int mode)
{
if (hapd->driver == NULL || hapd->driver->set_mode == NULL)
return 0;
return hapd->driver->set_mode(hapd->drv_priv, mode);
}
static inline int hostapd_driver_scan(struct hostapd_data *hapd,
struct wpa_driver_scan_params *params)
{

View file

@ -1327,11 +1327,6 @@ static int setup_interface(struct hostapd_iface *iface)
iface->bss[i]->drv_priv = hapd->drv_priv;
}
if (hostapd_driver_set_mode(hapd, IEEE80211_MODE_AP)) {
wpa_printf(MSG_ERROR, "Failed to set driver in AP mode");
return -1;
}
if (hostapd_validate_bssid_configuration(iface))
return -1;

View file

@ -18,7 +18,6 @@
enum privsep_cmd {
PRIVSEP_CMD_REGISTER,
PRIVSEP_CMD_UNREGISTER,
PRIVSEP_CMD_SET_WPA,
PRIVSEP_CMD_SCAN,
PRIVSEP_CMD_GET_SCAN_RESULTS,
PRIVSEP_CMD_ASSOCIATE,
@ -30,7 +29,6 @@ enum privsep_cmd {
PRIVSEP_CMD_L2_UNREGISTER,
PRIVSEP_CMD_L2_NOTIFY_AUTH_START,
PRIVSEP_CMD_L2_SEND,
PRIVSEP_CMD_SET_MODE,
PRIVSEP_CMD_SET_COUNTRY,
};

View file

@ -567,30 +567,6 @@ struct wpa_driver_ops {
*/
int (*get_ssid)(void *priv, u8 *ssid);
/**
* set_wpa - Enable/disable WPA support (OBSOLETE)
* @priv: private driver interface data
* @enabled: 1 = enable, 0 = disable
*
* Returns: 0 on success, -1 on failure
*
* Note: This function is included for backwards compatibility. This is
* called only just after init and just before deinit, so these
* functions can be used to implement same functionality and the driver
* interface need not define this function.
*
* Configure the kernel driver to enable/disable WPA support. This may
* be empty function, if WPA support is always enabled. Common
* configuration items are WPA IE (clearing it when WPA support is
* disabled), Privacy flag configuration for capability field (note:
* this the value need to set in associate handler to allow plaintext
* mode to be used) when trying to associate with, roaming mode (can
* allow wpa_supplicant to control roaming if ap_scan=1 is used;
* however, drivers can also implement roaming if desired, especially
* ap_scan=2 mode is used for this).
*/
int (*set_wpa)(void *priv, int enabled);
/**
* set_key - Configure encryption key
* @ifname: Interface name (for multi-SSID/VLAN support)
@ -698,22 +674,6 @@ struct wpa_driver_ops {
*/
int (*set_countermeasures)(void *priv, int enabled);
/**
* set_drop_unencrypted - Enable/disable unencrypted frame filtering
* @priv: private driver interface data
* @enabled: 1 = unencrypted Tx/Rx frames will be dropped, 0 = disabled
*
* Returns: 0 on success, -1 on failure
*
* Configure the driver to drop all non-EAPOL frames (both receive and
* transmit paths). Unencrypted EAPOL frames (ethertype 0x888e) must
* still be allowed for key negotiation.
*
* This function is deprecated. New driver wrapper implementations
* should use associate() parameter drop_unencrypted instead.
*/
int (*set_drop_unencrypted)(void *priv, int enabled);
/**
* scan - Request the driver to initiate scan (old version)
* @priv: private driver interface data
@ -785,30 +745,6 @@ struct wpa_driver_ops {
int (*associate)(void *priv,
struct wpa_driver_associate_params *params);
/**
* set_auth_alg - Set IEEE 802.11 authentication algorithm
* @priv: private driver interface data
* @auth_alg: bit field of AUTH_ALG_*
*
* If the driver supports more than one authentication algorithm at the
* same time, it should configure all supported algorithms. If not, one
* algorithm needs to be selected arbitrarily. Open System
* authentication should be ok for most cases and it is recommended to
* be used if other options are not supported. Static WEP configuration
* may also use Shared Key authentication and LEAP requires its own
* algorithm number. For LEAP, user can make sure that only one
* algorithm is used at a time by configuring LEAP as the only
* supported EAP method. This information is also available in
* associate() params, so set_auth_alg may not be needed in case of
* most drivers.
*
* This function is deprecated. New driver wrapper implementations
* should use associate() parameter auth_alg instead.
*
* Returns: 0 on success, -1 on failure
*/
int (*set_auth_alg)(void *priv, int auth_alg);
/**
* add_pmkid - Add PMKSA cache entry to the driver
* @priv: private driver interface data
@ -1114,24 +1050,6 @@ struct wpa_driver_ops {
*/
int (*set_probe_req_ie)(void *priv, const u8 *ies, size_t ies_len);
/**
* set_mode - Request driver to set the operating mode
* @priv: private driver interface data
* @mode: Operation mode (infra/ibss) IEEE80211_MODE_*
*
* This handler will be called before any key configuration and call to
* associate() handler in order to allow the operation mode to be
* configured as early as possible. This information is also available
* in associate() params and as such, driver wrappers may not need
* to implement set_mode() handler.
*
* This function is deprecated. New driver wrapper implementations
* should use associate() parameter mode instead.
*
* Returns: 0 on success, -1 on failure
*/
int (*set_mode)(void *priv, int mode);
/**
* set_country - Set country
* @priv: Private driver interface data

View file

@ -273,16 +273,6 @@ static int wpa_driver_atmel_set_countermeasures(void *priv,
}
static int wpa_driver_atmel_set_drop_unencrypted(void *priv,
int enabled)
{
/* FIX */
printf("wpa_driver_atmel_set_drop_unencrypted - not yet "
"implemented\n");
return 0;
}
static int wpa_driver_atmel_mlme(void *priv, const u8 *addr, int cmd,
int reason_code)
{
@ -473,6 +463,8 @@ static void * wpa_driver_atmel_init(void *ctx, const char *ifname)
return NULL;
}
wpa_driver_atmel_set_wpa(drv, 1);
return drv;
}
@ -480,6 +472,7 @@ static void * wpa_driver_atmel_init(void *ctx, const char *ifname)
static void wpa_driver_atmel_deinit(void *priv)
{
struct wpa_driver_atmel_data *drv = priv;
wpa_driver_atmel_set_wpa(drv, 0);
wpa_driver_wext_deinit(drv->wext);
close(drv->sock);
os_free(drv);
@ -491,12 +484,10 @@ const struct wpa_driver_ops wpa_driver_atmel_ops = {
.desc = "ATMEL AT76C5XXx (USB, PCMCIA)",
.get_bssid = wpa_driver_atmel_get_bssid,
.get_ssid = wpa_driver_atmel_get_ssid,
.set_wpa = wpa_driver_atmel_set_wpa,
.set_key = wpa_driver_atmel_set_key,
.init = wpa_driver_atmel_init,
.deinit = wpa_driver_atmel_deinit,
.set_countermeasures = wpa_driver_atmel_set_countermeasures,
.set_drop_unencrypted = wpa_driver_atmel_set_drop_unencrypted,
.scan = wpa_driver_atmel_scan,
.get_scan_results2 = wpa_driver_atmel_get_scan_results,
.deauthenticate = wpa_driver_atmel_deauthenticate,

View file

@ -349,6 +349,7 @@ static void * wpa_driver_broadcom_init(void *ctx, const char *ifname)
eloop_register_read_sock(s, wpa_driver_broadcom_event_receive, ctx,
NULL);
drv->event_sock = s;
wpa_driver_broadcom_set_wpa(drv, 1);
return drv;
}
@ -356,6 +357,7 @@ static void * wpa_driver_broadcom_init(void *ctx, const char *ifname)
static void wpa_driver_broadcom_deinit(void *priv)
{
struct wpa_driver_broadcom_data *drv = priv;
wpa_driver_broadcom_set_wpa(drv, 0);
eloop_cancel_timeout(wpa_driver_broadcom_scan_timeout, drv, drv->ctx);
eloop_unregister_read_sock(drv->event_sock);
close(drv->event_sock);
@ -531,7 +533,11 @@ wpa_driver_broadcom_associate(void *priv,
int wsec = 4;
int dummy;
int wpa_auth;
int ret;
ret = wpa_driver_broadcom_set_drop_unencrypted(
drv, params->drop_unencrypted);
s.SSID_len = params->ssid_len;
os_memcpy(s.SSID, params->ssid, params->ssid_len);
@ -583,7 +589,7 @@ wpa_driver_broadcom_associate(void *priv,
broadcom_ioctl(drv, WLC_SET_SSID, &s, sizeof(s)) < 0)
return -1;
return 0;
return ret;
}
const struct wpa_driver_ops wpa_driver_broadcom_ops = {
@ -591,12 +597,10 @@ const struct wpa_driver_ops wpa_driver_broadcom_ops = {
.desc = "Broadcom wl.o driver",
.get_bssid = wpa_driver_broadcom_get_bssid,
.get_ssid = wpa_driver_broadcom_get_ssid,
.set_wpa = wpa_driver_broadcom_set_wpa,
.set_key = wpa_driver_broadcom_set_key,
.init = wpa_driver_broadcom_init,
.deinit = wpa_driver_broadcom_deinit,
.set_countermeasures = wpa_driver_broadcom_set_countermeasures,
.set_drop_unencrypted = wpa_driver_broadcom_set_drop_unencrypted,
.scan = wpa_driver_broadcom_scan,
.get_scan_results = wpa_driver_broadcom_get_scan_results,
.deauthenticate = wpa_driver_broadcom_deauthenticate,

View file

@ -1152,6 +1152,7 @@ wpa_driver_bsd_associate(void *priv, struct wpa_driver_associate_params *params)
struct wpa_driver_bsd_data *drv = priv;
struct ieee80211req_mlme mlme;
int privacy;
int ret = 0;
wpa_printf(MSG_DEBUG,
"%s: ssid '%.*s' wpa ie len %u pairwise %u group %u key mgmt %u"
@ -1163,6 +1164,11 @@ wpa_driver_bsd_associate(void *priv, struct wpa_driver_associate_params *params)
, params->key_mgmt_suite
);
if (wpa_driver_bsd_set_drop_unencrypted(drv, params->drop_unencrypted)
< 0)
ret = -1;
if (wpa_driver_bsd_set_auth_alg(drv, params->auth_alg) < 0)
ret = -1;
/* XXX error handling is wrong but unclear what to do... */
if (wpa_driver_bsd_set_wpa_ie(drv, params->wpa_ie, params->wpa_ie_len) < 0)
return -1;
@ -1190,7 +1196,7 @@ wpa_driver_bsd_associate(void *priv, struct wpa_driver_associate_params *params)
os_memcpy(mlme.im_macaddr, params->bssid, IEEE80211_ADDR_LEN);
if (set80211var(drv, IEEE80211_IOC_MLME, &mlme, sizeof(mlme)) < 0)
return -1;
return 0;
return ret;
}
static int
@ -1473,6 +1479,8 @@ wpa_driver_bsd_init(void *ctx, const char *ifname)
goto fail;
}
wpa_driver_bsd_set_wpa(drv, 1);
return drv;
fail:
close(drv->sock);
@ -1488,6 +1496,7 @@ wpa_driver_bsd_deinit(void *priv)
struct wpa_driver_bsd_data *drv = priv;
int flags;
wpa_driver_bsd_set_wpa(drv, 0);
eloop_unregister_read_sock(drv->route);
/* NB: mark interface down */
@ -1512,16 +1521,13 @@ const struct wpa_driver_ops wpa_driver_bsd_ops = {
.deinit = wpa_driver_bsd_deinit,
.get_bssid = wpa_driver_bsd_get_bssid,
.get_ssid = wpa_driver_bsd_get_ssid,
.set_wpa = wpa_driver_bsd_set_wpa,
.set_key = wpa_driver_bsd_set_key,
.set_countermeasures = wpa_driver_bsd_set_countermeasures,
.set_drop_unencrypted = wpa_driver_bsd_set_drop_unencrypted,
.scan = wpa_driver_bsd_scan,
.get_scan_results2 = wpa_driver_bsd_get_scan_results2,
.deauthenticate = wpa_driver_bsd_deauthenticate,
.disassociate = wpa_driver_bsd_disassociate,
.associate = wpa_driver_bsd_associate,
.set_auth_alg = wpa_driver_bsd_set_auth_alg,
};
#endif /* HOSTAPD */

View file

@ -1235,6 +1235,9 @@ struct wpa_driver_hostap_data {
};
static int wpa_driver_hostap_set_auth_alg(void *priv, int auth_alg);
static int hostapd_ioctl(struct wpa_driver_hostap_data *drv,
struct prism2_hostapd_param *param,
int len, int show_err)
@ -1435,14 +1438,6 @@ static int wpa_driver_hostap_set_countermeasures(void *priv, int enabled)
}
static int wpa_driver_hostap_set_drop_unencrypted(void *priv, int enabled)
{
struct wpa_driver_hostap_data *drv = priv;
wpa_printf(MSG_DEBUG, "%s: enabled=%d", __FUNCTION__, enabled);
return prism2param(drv, PRISM2_PARAM_DROP_UNENCRYPTED, enabled);
}
static int wpa_driver_hostap_reset(struct wpa_driver_hostap_data *drv,
int type)
{
@ -1518,6 +1513,11 @@ wpa_driver_hostap_associate(void *priv,
wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
if (prism2param(drv, PRISM2_PARAM_DROP_UNENCRYPTED,
params->drop_unencrypted) < 0)
ret = -1;
if (wpa_driver_hostap_set_auth_alg(drv, params->auth_alg) < 0)
ret = -1;
if (params->mode != drv->current_mode) {
/* At the moment, Host AP driver requires host_roaming=2 for
* infrastructure mode and host_roaming=0 for adhoc. */
@ -1682,6 +1682,8 @@ static void * wpa_driver_hostap_init(void *ctx, const char *ifname)
wpa_driver_wext_alternative_ifindex(drv->wext, ifname2);
}
wpa_driver_hostap_set_wpa(drv, 1);
return drv;
}
@ -1689,6 +1691,7 @@ static void * wpa_driver_hostap_init(void *ctx, const char *ifname)
static void wpa_driver_hostap_deinit(void *priv)
{
struct wpa_driver_hostap_data *drv = priv;
wpa_driver_hostap_set_wpa(drv, 0);
wpa_driver_wext_deinit(drv->wext);
close(drv->sock);
os_free(drv);
@ -1726,15 +1729,12 @@ const struct wpa_driver_ops wpa_driver_hostap_ops = {
#else /* HOSTAPD */
.get_bssid = wpa_driver_hostap_get_bssid,
.get_ssid = wpa_driver_hostap_get_ssid,
.set_wpa = wpa_driver_hostap_set_wpa,
.set_countermeasures = wpa_driver_hostap_set_countermeasures,
.set_drop_unencrypted = wpa_driver_hostap_set_drop_unencrypted,
.scan = wpa_driver_hostap_scan,
.get_scan_results2 = wpa_driver_hostap_get_scan_results,
.deauthenticate = wpa_driver_hostap_deauthenticate,
.disassociate = wpa_driver_hostap_disassociate,
.associate = wpa_driver_hostap_associate,
.set_auth_alg = wpa_driver_hostap_set_auth_alg,
.init = wpa_driver_hostap_init,
.deinit = wpa_driver_hostap_deinit,
.set_operstate = wpa_driver_hostap_set_operstate,

View file

@ -93,6 +93,8 @@ struct ipw_param {
/* end of ipw2100.c and ipw2200.c code */
static int wpa_driver_ipw_set_auth_alg(void *priv, int auth_alg);
static int ipw_ioctl(struct wpa_driver_ipw_data *drv,
struct ipw_param *param, int len, int show_err)
{
@ -318,6 +320,11 @@ wpa_driver_ipw_associate(void *priv, struct wpa_driver_associate_params *params)
int ret = 0;
int unencrypted_eapol;
if (wpa_driver_ipw_set_auth_alg(drv, params->auth_alg) < 0)
ret = -1;
if (wpa_driver_ipw_set_drop_unencrypted(drv, params->drop_unencrypted)
< 0)
ret = -1;
if (ipw_set_wpa_ie(drv, params->wpa_ie, params->wpa_ie_len) < 0)
ret = -1;
if (wpa_driver_wext_set_ssid(drv->wext, params->ssid,
@ -428,6 +435,8 @@ static void * wpa_driver_ipw_init(void *ctx, const char *ifname)
return NULL;
}
wpa_driver_ipw_set_wpa(drv, 1);
return drv;
}
@ -435,6 +444,7 @@ static void * wpa_driver_ipw_init(void *ctx, const char *ifname)
static void wpa_driver_ipw_deinit(void *priv)
{
struct wpa_driver_ipw_data *drv = priv;
wpa_driver_ipw_set_wpa(drv, 0);
wpa_driver_wext_deinit(drv->wext);
close(drv->sock);
os_free(drv);
@ -447,16 +457,13 @@ const struct wpa_driver_ops wpa_driver_ipw_ops = {
"or newer)",
.get_bssid = wpa_driver_ipw_get_bssid,
.get_ssid = wpa_driver_ipw_get_ssid,
.set_wpa = wpa_driver_ipw_set_wpa,
.set_key = wpa_driver_ipw_set_key,
.set_countermeasures = wpa_driver_ipw_set_countermeasures,
.set_drop_unencrypted = wpa_driver_ipw_set_drop_unencrypted,
.scan = wpa_driver_ipw_scan,
.get_scan_results2 = wpa_driver_ipw_get_scan_results,
.deauthenticate = wpa_driver_ipw_deauthenticate,
.disassociate = wpa_driver_ipw_disassociate,
.associate = wpa_driver_ipw_associate,
.set_auth_alg = wpa_driver_ipw_set_auth_alg,
.init = wpa_driver_ipw_init,
.deinit = wpa_driver_ipw_deinit,
.set_operstate = wpa_driver_ipw_set_operstate,

View file

@ -1386,6 +1386,9 @@ struct wpa_driver_madwifi_data {
int sock;
};
static int wpa_driver_madwifi_set_auth_alg(void *priv, int auth_alg);
static int
set80211priv(struct wpa_driver_madwifi_data *drv, int op, void *data, int len,
int show_err)
@ -1634,15 +1637,6 @@ wpa_driver_madwifi_set_countermeasures(void *priv, int enabled)
return set80211param(drv, IEEE80211_PARAM_COUNTERMEASURES, enabled, 1);
}
static int
wpa_driver_madwifi_set_drop_unencrypted(void *priv, int enabled)
{
struct wpa_driver_madwifi_data *drv = priv;
wpa_printf(MSG_DEBUG, "%s: enabled=%d", __FUNCTION__, enabled);
return set80211param(drv, IEEE80211_PARAM_DROPUNENCRYPTED, enabled, 1);
}
static int
wpa_driver_madwifi_deauthenticate(void *priv, const u8 *addr, int reason_code)
{
@ -1679,6 +1673,12 @@ wpa_driver_madwifi_associate(void *priv,
wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
if (set80211param(drv, IEEE80211_PARAM_DROPUNENCRYPTED,
params->drop_unencrypted, 1) < 0)
ret = -1;
if (wpa_driver_madwifi_set_auth_alg(drv, params->auth_alg) < 0)
ret = -1;
/*
* NB: Don't need to set the freq or cipher-related state as
* this is implied by the bssid which is used to locate
@ -1943,13 +1943,11 @@ const struct wpa_driver_ops wpa_driver_madwifi_ops = {
.init = wpa_driver_madwifi_init,
.deinit = wpa_driver_madwifi_deinit,
.set_countermeasures = wpa_driver_madwifi_set_countermeasures,
.set_drop_unencrypted = wpa_driver_madwifi_set_drop_unencrypted,
.scan = wpa_driver_madwifi_scan,
.get_scan_results2 = wpa_driver_madwifi_get_scan_results,
.deauthenticate = wpa_driver_madwifi_deauthenticate,
.disassociate = wpa_driver_madwifi_disassociate,
.associate = wpa_driver_madwifi_associate,
.set_auth_alg = wpa_driver_madwifi_set_auth_alg,
.set_operstate = wpa_driver_madwifi_set_operstate,
.set_probe_req_ie = wpa_driver_madwifi_set_probe_req_ie,
#endif /* HOSTAPD */

View file

@ -739,13 +739,6 @@ static int wpa_driver_ndis_disassociate(void *priv, const u8 *addr,
}
static int wpa_driver_ndis_set_wpa(void *priv, int enabled)
{
wpa_printf(MSG_DEBUG, "%s: enabled=%d", __func__, enabled);
return 0;
}
static void wpa_driver_ndis_scan_timeout(void *eloop_ctx, void *timeout_ctx)
{
wpa_printf(MSG_DEBUG, "Scan timeout - try to get results");
@ -3175,19 +3168,16 @@ const struct wpa_driver_ops wpa_driver_ndis_ops = {
"Windows NDIS driver",
wpa_driver_ndis_get_bssid,
wpa_driver_ndis_get_ssid,
wpa_driver_ndis_set_wpa,
wpa_driver_ndis_set_key,
wpa_driver_ndis_init,
wpa_driver_ndis_deinit,
NULL /* set_param */,
NULL /* set_countermeasures */,
NULL /* set_drop_unencrypted */,
wpa_driver_ndis_scan,
NULL /* get_scan_results */,
wpa_driver_ndis_deauthenticate,
wpa_driver_ndis_disassociate,
wpa_driver_ndis_associate,
NULL /* set_auth_alg */,
wpa_driver_ndis_add_pmkid,
wpa_driver_ndis_remove_pmkid,
wpa_driver_ndis_flush_pmkid,
@ -3209,7 +3199,6 @@ const struct wpa_driver_ops wpa_driver_ndis_ops = {
NULL /* send_ft_action */,
wpa_driver_ndis_get_scan_results,
NULL /* set_probe_req_ie */,
NULL /* set_mode */,
NULL /* set_country */,
NULL /* global_init */,
NULL /* global_deinit */,

View file

@ -73,6 +73,8 @@ struct wpa_assoc_info
#define WPA_DEINIT SIOCIWFIRSTPRIV+10
#define WPA_GET_CAPA SIOCIWFIRSTPRIV+11
static int wpa_ndiswrapper_set_auth_alg(void *priv, int auth_alg);
static int get_socket(void)
{
static const int families[] = {
@ -223,6 +225,12 @@ wpa_ndiswrapper_associate(void *priv,
struct wpa_assoc_info wpa_assoc_info;
struct iwreq priv_req;
if (wpa_ndiswrapper_set_drop_unencrypted(drv,
params->drop_unencrypted) < 0)
ret = -1;
if (wpa_ndiswrapper_set_auth_alg(drv, params->auth_alg) < 0)
ret = -1;
os_memset(&priv_req, 0, sizeof(priv_req));
os_memset(&wpa_assoc_info, 0, sizeof(wpa_assoc_info));
@ -334,6 +342,8 @@ static void * wpa_ndiswrapper_init(void *ctx, const char *ifname)
return NULL;
}
wpa_ndiswrapper_set_wpa(drv, 1);
return drv;
}
@ -341,6 +351,7 @@ static void * wpa_ndiswrapper_init(void *ctx, const char *ifname)
static void wpa_ndiswrapper_deinit(void *priv)
{
struct wpa_driver_ndiswrapper_data *drv = priv;
wpa_ndiswrapper_set_wpa(drv, 0);
wpa_driver_wext_deinit(drv->wext);
close(drv->sock);
os_free(drv);
@ -350,14 +361,11 @@ static void wpa_ndiswrapper_deinit(void *priv)
const struct wpa_driver_ops wpa_driver_ndiswrapper_ops = {
.name = "ndiswrapper",
.desc = "Linux ndiswrapper (deprecated; use wext)",
.set_wpa = wpa_ndiswrapper_set_wpa,
.set_key = wpa_ndiswrapper_set_key,
.set_countermeasures = wpa_ndiswrapper_set_countermeasures,
.set_drop_unencrypted = wpa_ndiswrapper_set_drop_unencrypted,
.deauthenticate = wpa_ndiswrapper_deauthenticate,
.disassociate = wpa_ndiswrapper_disassociate,
.associate = wpa_ndiswrapper_associate,
.set_auth_alg = wpa_ndiswrapper_set_auth_alg,
.get_bssid = wpa_ndiswrapper_get_bssid,
.get_ssid = wpa_ndiswrapper_get_ssid,

View file

@ -2023,6 +2023,9 @@ static int wpa_driver_nl80211_authenticate(
drv->associated = 0;
if (wpa_driver_nl80211_set_mode(drv, IEEE80211_MODE_INFRA) < 0)
return -1;
retry:
msg = nlmsg_alloc();
if (!msg)
@ -3452,8 +3455,11 @@ static int wpa_driver_nl80211_associate(
return wpa_driver_nl80211_ap(drv, params);
#endif /* CONFIG_AP */
if (!(drv->capa.flags & WPA_DRIVER_FLAGS_SME))
if (!(drv->capa.flags & WPA_DRIVER_FLAGS_SME)) {
if (wpa_driver_nl80211_set_mode(drv, params->mode) < 0)
return -1;
return wpa_driver_nl80211_connect(drv, params);
}
drv->associated = 0;
@ -4306,7 +4312,7 @@ static void *i802_init(struct hostapd_data *hapd,
goto failed;
}
if (nl80211_set_mode(drv, drv->ifindex, NL80211_IFTYPE_AP)) {
if (wpa_driver_nl80211_set_mode(drv, IEEE80211_MODE_AP)) {
wpa_printf(MSG_ERROR, "nl80211: Failed to set interface %s "
"into AP mode", drv->ifname);
goto failed;
@ -4373,7 +4379,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.set_operstate = wpa_driver_nl80211_set_operstate,
.set_supp_port = wpa_driver_nl80211_set_supp_port,
.set_country = wpa_driver_nl80211_set_country,
.set_mode = wpa_driver_nl80211_set_mode,
.set_beacon = wpa_driver_nl80211_set_beacon,
#if defined(CONFIG_AP) || defined(HOSTAPD)
.send_mlme = wpa_driver_nl80211_send_mlme,

View file

@ -1300,6 +1300,10 @@ wpa_driver_prism54_associate(void *priv,
struct wpa_driver_prism54_data *drv = priv;
int ret = 0;
if (wpa_driver_prism54_set_drop_unencrypted(drv,
params->drop_unencrypted)
< 0)
ret = -1;
if (wpa_driver_prism54_set_wpa_ie(drv, params->wpa_ie,
params->wpa_ie_len) < 0)
ret = -1;
@ -1403,6 +1407,8 @@ static void * wpa_driver_prism54_init(void *ctx, const char *ifname)
return NULL;
}
wpa_driver_prism54_set_wpa(drv, 1);
return drv;
}
@ -1410,6 +1416,7 @@ static void * wpa_driver_prism54_init(void *ctx, const char *ifname)
static void wpa_driver_prism54_deinit(void *priv)
{
struct wpa_driver_prism54_data *drv = priv;
wpa_driver_prism54_set_wpa(drv, 0);
wpa_driver_wext_deinit(drv->wext);
close(drv->sock);
os_free(drv);
@ -1439,9 +1446,7 @@ const struct wpa_driver_ops wpa_driver_prism54_ops = {
#else /* HOSTAPD */
.get_bssid = wpa_driver_prism54_get_bssid,
.get_ssid = wpa_driver_prism54_get_ssid,
.set_wpa = wpa_driver_prism54_set_wpa,
.set_countermeasures = wpa_driver_prism54_set_countermeasures,
.set_drop_unencrypted = wpa_driver_prism54_set_drop_unencrypted,
.scan = wpa_driver_prism54_scan,
.get_scan_results2 = wpa_driver_prism54_get_scan_results,
.deauthenticate = wpa_driver_prism54_deauthenticate,

View file

@ -102,15 +102,6 @@ static int wpa_priv_cmd(struct wpa_driver_privsep_data *drv, int cmd,
}
static int wpa_driver_privsep_set_wpa(void *priv, int enabled)
{
struct wpa_driver_privsep_data *drv = priv;
wpa_printf(MSG_DEBUG, "%s: enabled=%d", __func__, enabled);
return wpa_priv_cmd(drv, PRIVSEP_CMD_SET_WPA, &enabled,
sizeof(enabled), NULL, NULL);
}
static int wpa_driver_privsep_scan(void *priv, const u8 *ssid, size_t ssid_len)
{
struct wpa_driver_privsep_data *drv = priv;
@ -748,15 +739,6 @@ static const u8 * wpa_driver_privsep_get_mac_addr(void *priv)
}
static int wpa_driver_privsep_set_mode(void *priv, int mode)
{
struct wpa_driver_privsep_data *drv = priv;
wpa_printf(MSG_DEBUG, "%s mode=%d", __func__, mode);
return wpa_priv_cmd(drv, PRIVSEP_CMD_SET_MODE, &mode, sizeof(mode),
NULL, NULL);
}
static int wpa_driver_privsep_set_country(void *priv, const char *alpha2)
{
struct wpa_driver_privsep_data *drv = priv;
@ -771,7 +753,6 @@ struct wpa_driver_ops wpa_driver_privsep_ops = {
"wpa_supplicant privilege separated driver",
.get_bssid = wpa_driver_privsep_get_bssid,
.get_ssid = wpa_driver_privsep_get_ssid,
.set_wpa = wpa_driver_privsep_set_wpa,
.set_key = wpa_driver_privsep_set_key,
.init = wpa_driver_privsep_init,
.deinit = wpa_driver_privsep_deinit,
@ -783,7 +764,6 @@ struct wpa_driver_ops wpa_driver_privsep_ops = {
.get_capa = wpa_driver_privsep_get_capa,
.get_mac_addr = wpa_driver_privsep_get_mac_addr,
.get_scan_results2 = wpa_driver_privsep_get_scan_results2,
.set_mode = wpa_driver_privsep_set_mode,
.set_country = wpa_driver_privsep_set_country,
};

View file

@ -1296,13 +1296,6 @@ static void wpa_driver_test_poll(void *eloop_ctx, void *timeout_ctx)
}
static int wpa_driver_test_set_wpa(void *priv, int enabled)
{
wpa_printf(MSG_DEBUG, "%s: enabled=%d", __func__, enabled);
return 0;
}
static void wpa_driver_test_scan_timeout(void *eloop_ctx, void *timeout_ctx)
{
wpa_printf(MSG_DEBUG, "Scan timeout - try to get results");
@ -2484,13 +2477,6 @@ fail:
}
static int wpa_driver_test_set_mode(void *priv, int mode)
{
struct wpa_driver_test_data *drv = priv;
return wpa_driver_update_mode(drv, mode == IEEE80211_MODE_AP);
}
const struct wpa_driver_ops wpa_driver_test_ops = {
"test",
"wpa_supplicant test driver",
@ -2517,7 +2503,6 @@ const struct wpa_driver_ops wpa_driver_test_ops = {
.set_wps_probe_resp_ie = test_driver_set_wps_probe_resp_ie,
.get_bssid = wpa_driver_test_get_bssid,
.get_ssid = wpa_driver_test_get_ssid,
.set_wpa = wpa_driver_test_set_wpa,
.set_key = wpa_driver_test_set_key,
.deinit = wpa_driver_test_deinit,
.set_param = wpa_driver_test_set_param,
@ -2540,5 +2525,4 @@ const struct wpa_driver_ops wpa_driver_test_ops = {
.init2 = wpa_driver_test_init2,
.get_interfaces = wpa_driver_test_get_interfaces,
.scan2 = wpa_driver_test_scan,
.set_mode = wpa_driver_test_set_mode,
};

View file

@ -36,6 +36,7 @@ static int wpa_driver_wext_flush_pmkid(void *priv);
static int wpa_driver_wext_get_range(void *priv);
static int wpa_driver_wext_finish_drv_init(struct wpa_driver_wext_data *drv);
static void wpa_driver_wext_disconnect(struct wpa_driver_wext_data *drv);
static int wpa_driver_wext_set_auth_alg(void *priv, int auth_alg);
static int wpa_driver_wext_send_oper_ifla(struct wpa_driver_wext_data *drv,
@ -940,6 +941,8 @@ void * wpa_driver_wext_init(void *ctx, const char *ifname)
if (wpa_driver_wext_finish_drv_init(drv) < 0)
goto err4;
wpa_driver_wext_set_auth_param(drv, IW_AUTH_WPA_ENABLED, 1);
return drv;
err4:
@ -1038,6 +1041,8 @@ void wpa_driver_wext_deinit(void *priv)
struct wpa_driver_wext_data *drv = priv;
int flags;
wpa_driver_wext_set_auth_param(drv, IW_AUTH_WPA_ENABLED, 0);
eloop_cancel_timeout(wpa_driver_wext_scan_timeout, drv, drv->ctx);
/*
@ -1653,16 +1658,6 @@ static int wpa_driver_wext_get_range(void *priv)
}
static int wpa_driver_wext_set_wpa(void *priv, int enabled)
{
struct wpa_driver_wext_data *drv = priv;
wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
return wpa_driver_wext_set_auth_param(drv, IW_AUTH_WPA_ENABLED,
enabled);
}
static int wpa_driver_wext_set_psk(struct wpa_driver_wext_data *drv,
const u8 *psk)
{
@ -2096,6 +2091,14 @@ int wpa_driver_wext_associate(void *priv,
wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
if (wpa_driver_wext_set_drop_unencrypted(drv, params->drop_unencrypted)
< 0)
ret = -1;
if (wpa_driver_wext_set_auth_alg(drv, params->auth_alg) < 0)
ret = -1;
if (wpa_driver_wext_set_mode(drv, params->mode) < 0)
ret = -1;
/*
* If the driver did not support SIOCSIWAUTH, fallback to
* SIOCSIWENCODE here.
@ -2374,17 +2377,13 @@ const struct wpa_driver_ops wpa_driver_wext_ops = {
.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_results2 = wpa_driver_wext_get_scan_results,
.deauthenticate = wpa_driver_wext_deauthenticate,
.disassociate = wpa_driver_wext_disassociate,
.set_mode = wpa_driver_wext_set_mode,
.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,

View file

@ -43,16 +43,6 @@ static inline int wpa_drv_set_param(struct wpa_supplicant *wpa_s,
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)
{
@ -63,32 +53,6 @@ static inline int wpa_drv_set_countermeasures(struct wpa_supplicant *wpa_s,
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)
{

View file

@ -51,8 +51,6 @@ static void wpa_priv_cmd_register(struct wpa_priv_interface *iface,
{
if (iface->drv_priv) {
wpa_printf(MSG_DEBUG, "Cleaning up forgotten driver instance");
if (iface->driver->set_wpa)
iface->driver->set_wpa(iface->drv_priv, 0);
if (iface->driver->deinit)
iface->driver->deinit(iface->drv_priv);
iface->drv_priv = NULL;
@ -85,9 +83,6 @@ static void wpa_priv_cmd_register(struct wpa_priv_interface *iface,
iface->driver->set_param(iface->drv_priv, NULL) < 0) {
wpa_printf(MSG_ERROR, "Driver interface rejected param");
}
if (iface->driver->set_wpa)
iface->driver->set_wpa(iface->drv_priv, 1);
}
@ -95,8 +90,6 @@ static void wpa_priv_cmd_unregister(struct wpa_priv_interface *iface,
struct sockaddr_un *from)
{
if (iface->drv_priv) {
if (iface->driver->set_wpa)
iface->driver->set_wpa(iface->drv_priv, 0);
if (iface->driver->deinit)
iface->driver->deinit(iface->drv_priv);
iface->drv_priv = NULL;
@ -105,17 +98,6 @@ static void wpa_priv_cmd_unregister(struct wpa_priv_interface *iface,
}
static void wpa_priv_cmd_set_wpa(struct wpa_priv_interface *iface,
char *buf, size_t len)
{
if (iface->drv_priv == NULL || len != sizeof(int))
return;
if (iface->driver->set_wpa)
iface->driver->set_wpa(iface->drv_priv, *((int *) buf));
}
static void wpa_priv_cmd_scan(struct wpa_priv_interface *iface,
char *buf, size_t len)
{
@ -613,9 +595,6 @@ static void wpa_priv_receive(int sock, void *eloop_ctx, void *sock_ctx)
case PRIVSEP_CMD_UNREGISTER:
wpa_priv_cmd_unregister(iface, &from);
break;
case PRIVSEP_CMD_SET_WPA:
wpa_priv_cmd_set_wpa(iface, cmd_buf, cmd_len);
break;
case PRIVSEP_CMD_SCAN:
wpa_priv_cmd_scan(iface, cmd_buf, cmd_len);
break;

View file

@ -1038,11 +1038,6 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
* previous association. */
wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0);
if (wpa_drv_set_mode(wpa_s, ssid->mode)) {
wpa_printf(MSG_WARNING, "Failed to set operating mode");
assoc_failed = 1;
}
#ifdef IEEE8021X_EAPOL
if (ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA) {
if (ssid->leap) {
@ -1065,7 +1060,6 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
wpa_printf(MSG_DEBUG, "Overriding auth_alg selection: 0x%x",
algs);
}
wpa_drv_set_auth_alg(wpa_s, algs);
if (bss && (wpa_scan_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE) ||
wpa_scan_get_ie(bss, WLAN_EID_RSN)) &&
@ -1155,7 +1149,6 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
wpa_supplicant_set_wpa_none_key(wpa_s, ssid);
}
wpa_drv_set_drop_unencrypted(wpa_s, use_crypt);
wpa_supplicant_set_state(wpa_s, WPA_ASSOCIATING);
os_memset(&params, 0, sizeof(params));
if (bss) {
@ -1993,31 +1986,12 @@ int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s)
}
}
/* Backwards compatibility call to set_wpa() handler. This is called
* only just after init and just before deinit, so these handler can be
* used to implement same functionality. */
if (wpa_drv_set_wpa(wpa_s, 1) < 0) {
struct wpa_driver_capa capa;
if (wpa_drv_get_capa(wpa_s, &capa) < 0 ||
!(capa.flags & (WPA_DRIVER_CAPA_KEY_MGMT_WPA |
WPA_DRIVER_CAPA_KEY_MGMT_WPA2))) {
wpa_printf(MSG_DEBUG, "Driver does not support WPA.");
/* Continue to allow non-WPA modes to be used. */
} else {
wpa_printf(MSG_ERROR, "Failed to enable WPA in the "
"driver.");
return -1;
}
}
wpa_clear_keys(wpa_s, NULL);
/* Make sure that TKIP countermeasures are not left enabled (could
* happen if wpa_supplicant is killed during countermeasures. */
wpa_drv_set_countermeasures(wpa_s, 0);
wpa_drv_set_drop_unencrypted(wpa_s, 1);
wpa_printf(MSG_DEBUG, "RSN: flushing PMKID list in the driver");
wpa_drv_flush_pmkid(wpa_s);
@ -2259,15 +2233,6 @@ static void wpa_supplicant_deinit_iface(struct wpa_supplicant *wpa_s)
wpa_supplicant_deauthenticate(wpa_s,
WLAN_REASON_DEAUTH_LEAVING);
/* Backwards compatibility call to set_wpa() handler. This is
* called only just after init and just before deinit, so these
* handler can be used to implement same functionality. */
if (wpa_drv_set_wpa(wpa_s, 0) < 0) {
wpa_printf(MSG_ERROR, "Failed to disable WPA in the "
"driver.");
}
wpa_drv_set_drop_unencrypted(wpa_s, 0);
wpa_drv_set_countermeasures(wpa_s, 0);
wpa_clear_keys(wpa_s, NULL);
}