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>
This commit is contained in:
Avraham Stern 2017-03-08 14:37:40 +02:00 committed by Jouni Malinen
parent e044a9d1e0
commit 15ab61eda0
3 changed files with 34 additions and 10 deletions

View file

@ -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 */

View file

@ -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);

View file

@ -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);