aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvraham Stern <avraham.stern@intel.com>2017-03-08 12:37:40 (GMT)
committerJouni Malinen <j@w1.fi>2017-03-11 08:47:28 (GMT)
commit15ab61eda0217a4761d1a9bb85c6d525c775bcbd (patch)
tree936cb4d77142b30befd02c6d0c8ec7bc20ae5d67
parente044a9d1e0b23c1d8193065469983374505acaf2 (diff)
downloadhostap-15ab61eda0217a4761d1a9bb85c6d525c775bcbd.zip
hostap-15ab61eda0217a4761d1a9bb85c6d525c775bcbd.tar.gz
hostap-15ab61eda0217a4761d1a9bb85c6d525c775bcbd.tar.bz2
WNM: Add option to configure candidates for BTM query candidate list
Add a mechanism to configure the candidates for BTM query candidate list manually. This can be used to verify AP behavior for various candidates preferences. usage: wnm_bss_query <reason> [neighbor=<BSSID>,<BSSID information>, <operating class>,<channel number>, <PHY type>[,<hexdump of optional subelements>]] Signed-off-by: Avraham Stern <avraham.stern@intel.com>
-rw-r--r--wpa_supplicant/ctrl_iface.c15
-rw-r--r--wpa_supplicant/wnm_sta.c24
-rw-r--r--wpa_supplicant/wnm_sta.h5
3 files changed, 34 insertions, 10 deletions
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 08348d2..95cae13 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -7157,26 +7157,25 @@ static int wpas_ctrl_iface_wnm_sleep(struct wpa_supplicant *wpa_s, char *cmd)
static int wpas_ctrl_iface_wnm_bss_query(struct wpa_supplicant *wpa_s, char *cmd)
{
int query_reason, list = 0;
+ char *btm_candidates = NULL;
query_reason = atoi(cmd);
cmd = os_strchr(cmd, ' ');
if (cmd) {
- cmd++;
- if (os_strncmp(cmd, "list", 4) == 0) {
+ if (os_strncmp(cmd, " list", 5) == 0)
list = 1;
- } else {
- wpa_printf(MSG_DEBUG, "WNM Query: Invalid option %s",
- cmd);
- return -1;
- }
+ else
+ btm_candidates = cmd;
}
wpa_printf(MSG_DEBUG,
"CTRL_IFACE: WNM_BSS_QUERY query_reason=%d%s",
query_reason, list ? " candidate list" : "");
- return wnm_send_bss_transition_mgmt_query(wpa_s, query_reason, list);
+ return wnm_send_bss_transition_mgmt_query(wpa_s, query_reason,
+ btm_candidates,
+ list);
}
#endif /* CONFIG_WNM */
diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c
index c4f77e7..dd6ce8d 100644
--- a/wpa_supplicant/wnm_sta.c
+++ b/wpa_supplicant/wnm_sta.c
@@ -1486,7 +1486,9 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s,
#define BTM_QUERY_MIN_SIZE 4
int wnm_send_bss_transition_mgmt_query(struct wpa_supplicant *wpa_s,
- u8 query_reason, int cand_list)
+ u8 query_reason,
+ const char *btm_candidates,
+ int cand_list)
{
struct wpabuf *buf;
int ret;
@@ -1508,6 +1510,26 @@ int wnm_send_bss_transition_mgmt_query(struct wpa_supplicant *wpa_s,
if (cand_list)
wnm_add_cand_list(wpa_s, &buf);
+ if (btm_candidates) {
+ const size_t max_len = 1000;
+
+ ret = wpabuf_resize(&buf, max_len);
+ if (ret < 0) {
+ wpabuf_free(buf);
+ return ret;
+ }
+
+ ret = ieee802_11_parse_candidate_list(btm_candidates,
+ wpabuf_put(buf, 0),
+ max_len);
+ if (ret < 0) {
+ wpabuf_free(buf);
+ return ret;
+ }
+
+ wpabuf_put(buf, ret);
+ }
+
ret = wpa_drv_send_action(wpa_s, wpa_s->assoc_freq, 0, wpa_s->bssid,
wpa_s->own_addr, wpa_s->bssid,
wpabuf_head_u8(buf), wpabuf_len(buf), 0);
diff --git a/wpa_supplicant/wnm_sta.h b/wpa_supplicant/wnm_sta.h
index 78b87d0..02cd1cd 100644
--- a/wpa_supplicant/wnm_sta.h
+++ b/wpa_supplicant/wnm_sta.h
@@ -60,7 +60,10 @@ void ieee802_11_rx_wnm_action(struct wpa_supplicant *wpa_s,
const struct ieee80211_mgmt *mgmt, size_t len);
int wnm_send_bss_transition_mgmt_query(struct wpa_supplicant *wpa_s,
- u8 query_reason, int cand_list);
+ u8 query_reason,
+ const char *btm_candidates,
+ int cand_list);
+
void wnm_deallocate_memory(struct wpa_supplicant *wpa_s);