driver: Move add_pmkid() and remove_pmkid() arguments into a struct

This makes it easier to add more arguments to these wpa_driver_ops
functions.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Vidyullatha Kanchanapally 2017-03-30 19:27:15 +05:30 committed by Jouni Malinen
parent ad295f3b85
commit 6fbb54140b
6 changed files with 55 additions and 29 deletions

View File

@ -1962,6 +1962,11 @@ struct wpa_bss_candidate_info {
} *candidates;
};
struct wpa_pmkid_params {
const u8 *bssid;
const u8 *pmkid;
};
/**
* struct wpa_driver_ops - Driver interface API definition
*
@ -2143,8 +2148,7 @@ struct wpa_driver_ops {
/**
* add_pmkid - Add PMKSA cache entry to the driver
* @priv: private driver interface data
* @bssid: BSSID for the PMKSA cache entry
* @pmkid: PMKID for the PMKSA cache entry
* @params: PMKSA parameters
*
* Returns: 0 on success, -1 on failure
*
@ -2157,13 +2161,12 @@ struct wpa_driver_ops {
* driver_ops function does not need to be implemented. Likewise, if
* the driver does not support WPA, this function is not needed.
*/
int (*add_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
int (*add_pmkid)(void *priv, struct wpa_pmkid_params *params);
/**
* remove_pmkid - Remove PMKSA cache entry to the driver
* @priv: private driver interface data
* @bssid: BSSID for the PMKSA cache entry
* @pmkid: PMKID for the PMKSA cache entry
* @params: PMKSA parameters
*
* Returns: 0 on success, -1 on failure
*
@ -2177,7 +2180,7 @@ struct wpa_driver_ops {
* implemented. Likewise, if the driver does not support WPA, this
* function is not needed.
*/
int (*remove_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
int (*remove_pmkid)(void *priv, struct wpa_pmkid_params *params);
/**
* flush_pmkid - Flush PMKSA cache

View File

@ -1220,12 +1220,16 @@ static int wpa_driver_ndis_set_pmkid(struct wpa_driver_ndis_data *drv)
}
static int wpa_driver_ndis_add_pmkid(void *priv, const u8 *bssid,
const u8 *pmkid)
static int wpa_driver_ndis_add_pmkid(void *priv,
struct wpa_pmkid_params *params)
{
struct wpa_driver_ndis_data *drv = priv;
struct ndis_pmkid_entry *entry, *prev;
const u8 *bssid = params->bssid;
const u8 *pmkid = params->pmkid;
if (!bssid || !pmkid)
return -1;
if (drv->no_of_pmkid == 0)
return 0;
@ -1261,12 +1265,16 @@ static int wpa_driver_ndis_add_pmkid(void *priv, const u8 *bssid,
}
static int wpa_driver_ndis_remove_pmkid(void *priv, const u8 *bssid,
const u8 *pmkid)
static int wpa_driver_ndis_remove_pmkid(void *priv,
struct wpa_pmkid_params *params)
{
struct wpa_driver_ndis_data *drv = priv;
struct ndis_pmkid_entry *entry, *prev;
const u8 *bssid = params->bssid;
const u8 *pmkid = params->pmkid;
if (!bssid || !pmkid)
return -1;
if (drv->no_of_pmkid == 0)
return 0;

View File

@ -7476,20 +7476,23 @@ static int nl80211_pmkid(struct i802_bss *bss, int cmd, const u8 *bssid,
}
static int nl80211_add_pmkid(void *priv, const u8 *bssid, const u8 *pmkid)
static int nl80211_add_pmkid(void *priv, struct wpa_pmkid_params *params)
{
struct i802_bss *bss = priv;
wpa_printf(MSG_DEBUG, "nl80211: Add PMKID for " MACSTR, MAC2STR(bssid));
return nl80211_pmkid(bss, NL80211_CMD_SET_PMKSA, bssid, pmkid);
wpa_printf(MSG_DEBUG, "nl80211: Add PMKID for " MACSTR,
MAC2STR(params->bssid));
return nl80211_pmkid(bss, NL80211_CMD_SET_PMKSA, params->bssid,
params->pmkid);
}
static int nl80211_remove_pmkid(void *priv, const u8 *bssid, const u8 *pmkid)
static int nl80211_remove_pmkid(void *priv, struct wpa_pmkid_params *params)
{
struct i802_bss *bss = priv;
wpa_printf(MSG_DEBUG, "nl80211: Delete PMKID for " MACSTR,
MAC2STR(bssid));
return nl80211_pmkid(bss, NL80211_CMD_DEL_PMKSA, bssid, pmkid);
MAC2STR(params->bssid));
return nl80211_pmkid(bss, NL80211_CMD_DEL_PMKSA, params->bssid,
params->pmkid);
}

View File

@ -2351,19 +2351,21 @@ static int wpa_driver_wext_pmksa(struct wpa_driver_wext_data *drv,
}
static int wpa_driver_wext_add_pmkid(void *priv, const u8 *bssid,
const u8 *pmkid)
static int wpa_driver_wext_add_pmkid(void *priv,
struct wpa_pmkid_params *params)
{
struct wpa_driver_wext_data *drv = priv;
return wpa_driver_wext_pmksa(drv, IW_PMKSA_ADD, bssid, pmkid);
return wpa_driver_wext_pmksa(drv, IW_PMKSA_ADD, params->bssid,
params->pmkid);
}
static int wpa_driver_wext_remove_pmkid(void *priv, const u8 *bssid,
const u8 *pmkid)
static int wpa_driver_wext_remove_pmkid(void *priv,
struct wpa_pmkid_params *params)
{
struct wpa_driver_wext_data *drv = priv;
return wpa_driver_wext_pmksa(drv, IW_PMKSA_REMOVE, bssid, pmkid);
return wpa_driver_wext_pmksa(drv, IW_PMKSA_REMOVE, params->bssid,
params->pmkid);
}

View File

@ -189,20 +189,19 @@ static inline int wpa_drv_deauthenticate(struct wpa_supplicant *wpa_s,
}
static inline int wpa_drv_add_pmkid(struct wpa_supplicant *wpa_s,
const u8 *bssid, const u8 *pmkid)
struct wpa_pmkid_params *params)
{
if (wpa_s->driver->add_pmkid) {
return wpa_s->driver->add_pmkid(wpa_s->drv_priv, bssid, pmkid);
return wpa_s->driver->add_pmkid(wpa_s->drv_priv, params);
}
return -1;
}
static inline int wpa_drv_remove_pmkid(struct wpa_supplicant *wpa_s,
const u8 *bssid, const u8 *pmkid)
struct wpa_pmkid_params *params)
{
if (wpa_s->driver->remove_pmkid) {
return wpa_s->driver->remove_pmkid(wpa_s->drv_priv, bssid,
pmkid);
return wpa_s->driver->remove_pmkid(wpa_s->drv_priv, params);
}
return -1;
}

View File

@ -534,12 +534,17 @@ static int wpa_supplicant_add_pmkid(void *_wpa_s, void *network_ctx,
{
struct wpa_supplicant *wpa_s = _wpa_s;
struct wpa_ssid *ssid;
struct wpa_pmkid_params params;
os_memset(&params, 0, sizeof(params));
ssid = wpas_get_network_ctx(wpa_s, network_ctx);
if (ssid)
wpa_msg(wpa_s, MSG_INFO, PMKSA_CACHE_ADDED MACSTR " %d",
MAC2STR(bssid), ssid->id);
return wpa_drv_add_pmkid(wpa_s, bssid, pmkid);
params.bssid = bssid;
params.pmkid = pmkid;
return wpa_drv_add_pmkid(wpa_s, &params);
}
@ -548,12 +553,18 @@ static int wpa_supplicant_remove_pmkid(void *_wpa_s, void *network_ctx,
{
struct wpa_supplicant *wpa_s = _wpa_s;
struct wpa_ssid *ssid;
struct wpa_pmkid_params params;
os_memset(&params, 0, sizeof(params));
ssid = wpas_get_network_ctx(wpa_s, network_ctx);
if (ssid)
wpa_msg(wpa_s, MSG_INFO, PMKSA_CACHE_REMOVED MACSTR " %d",
MAC2STR(bssid), ssid->id);
return wpa_drv_remove_pmkid(wpa_s, bssid, pmkid);
params.bssid = bssid;
params.pmkid = pmkid;
return wpa_drv_remove_pmkid(wpa_s, &params);
}