From c8082d2b6a3dde59bbc60f909a9dfd10431753b2 Mon Sep 17 00:00:00 2001 From: Avraham Stern Date: Mon, 15 Feb 2016 16:53:37 +0200 Subject: [PATCH] MBO: Add MBO IE to BSS Transition Management Response frame When rejecting a BSS Transition Management Request frame, add MBO IE to the BSS Transition Management Response frame to specify the transition rejection reason. Signed-off-by: David Spinadel Signed-off-by: Avraham Stern --- wpa_supplicant/mbo.c | 14 ++++++++++++++ wpa_supplicant/wnm_sta.c | 8 ++++++++ wpa_supplicant/wpa_supplicant_i.h | 3 +++ 3 files changed, 25 insertions(+) diff --git a/wpa_supplicant/mbo.c b/wpa_supplicant/mbo.c index e0976c57c..0fac6b7f7 100644 --- a/wpa_supplicant/mbo.c +++ b/wpa_supplicant/mbo.c @@ -716,3 +716,17 @@ fail: wpa_printf(MSG_DEBUG, "MBO IE parsing failed (id=%u len=%u left=%zu)", id, elen, len); } + + +size_t wpas_mbo_ie_bss_trans_reject(struct wpa_supplicant *wpa_s, u8 *pos, + size_t len, + enum mbo_transition_reject_reason reason) +{ + u8 reject_attr[3]; + + reject_attr[0] = MBO_ATTR_ID_TRANSITION_REJECT_REASON; + reject_attr[1] = 1; + reject_attr[2] = reason; + + return mbo_add_ie(pos, len, reject_attr, sizeof(reject_attr)); +} diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c index 31411e3ac..e978a19ae 100644 --- a/wpa_supplicant/wnm_sta.c +++ b/wpa_supplicant/wnm_sta.c @@ -620,6 +620,14 @@ static void wnm_send_bss_transition_mgmt_resp( pos += ETH_ALEN; } +#ifdef CONFIG_MBO + if (status != WNM_BSS_TM_ACCEPT) { + pos += wpas_mbo_ie_bss_trans_reject( + wpa_s, pos, buf + sizeof(buf) - pos, + MBO_TRANSITION_REJECT_REASON_UNSPECIFIED); + } +#endif /* CONFIG_MBO */ + len = pos - (u8 *) &mgmt->u.action.category; res = wpa_drv_send_action(wpa_s, wpa_s->assoc_freq, 0, wpa_s->bssid, diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 07318fa68..183752a46 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -1164,6 +1164,9 @@ int wpas_mbo_supp_op_class_ie(struct wpa_supplicant *wpa_s, int freq, u8 *pos, size_t len); void wpas_mbo_ie_trans_req(struct wpa_supplicant *wpa_s, const u8 *ie, size_t len); +size_t wpas_mbo_ie_bss_trans_reject(struct wpa_supplicant *wpa_s, u8 *pos, + size_t len, + enum mbo_transition_reject_reason reason); /** * wpa_supplicant_ctrl_iface_ctrl_rsp_handle - Handle a control response