aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVidyullatha Kanchanapally <vkanchan@qti.qualcomm.com>2017-03-30 13:57:15 (GMT)
committerJouni Malinen <j@w1.fi>2017-04-07 14:03:35 (GMT)
commit6fbb54140be2710be43ddc9d257e094aa5e6d496 (patch)
tree14c6b4b11fd62305b11bf00e826bb6562d510c67
parentad295f3b85756a188d4c18f98f59bfce1a28efeb (diff)
downloadhostap-6fbb54140be2710be43ddc9d257e094aa5e6d496.zip
hostap-6fbb54140be2710be43ddc9d257e094aa5e6d496.tar.gz
hostap-6fbb54140be2710be43ddc9d257e094aa5e6d496.tar.bz2
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>
-rw-r--r--src/drivers/driver.h15
-rw-r--r--src/drivers/driver_ndis.c16
-rw-r--r--src/drivers/driver_nl80211.c15
-rw-r--r--src/drivers/driver_wext.c14
-rw-r--r--wpa_supplicant/driver_i.h9
-rw-r--r--wpa_supplicant/wpas_glue.c15
6 files changed, 55 insertions, 29 deletions
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 999b6a6..2953767 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -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
diff --git a/src/drivers/driver_ndis.c b/src/drivers/driver_ndis.c
index 9440f01..614c452 100644
--- a/src/drivers/driver_ndis.c
+++ b/src/drivers/driver_ndis.c
@@ -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;
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 8671e73..51d9b1a 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -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);
}
diff --git a/src/drivers/driver_wext.c b/src/drivers/driver_wext.c
index 47b90eb..353faeb 100644
--- a/src/drivers/driver_wext.c
+++ b/src/drivers/driver_wext.c
@@ -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);
}
diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h
index cc41b27..facceb9 100644
--- a/wpa_supplicant/driver_i.h
+++ b/wpa_supplicant/driver_i.h
@@ -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;
}
diff --git a/wpa_supplicant/wpas_glue.c b/wpa_supplicant/wpas_glue.c
index 52904d3..71dfbc3 100644
--- a/wpa_supplicant/wpas_glue.c
+++ b/wpa_supplicant/wpas_glue.c
@@ -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);
}