From 74f8e768f222cb585a7d0a6bfbabd48967df3008 Mon Sep 17 00:00:00 2001 From: Ankita Bajaj Date: Fri, 5 Apr 2019 14:37:40 +0530 Subject: [PATCH] MBO: Always include Non-preferred Channel Report attribute in AssocReq Include the Non-preferred Channel Report attribute in (Re)Association Request frames even when the MBO STA has no non-preferred channels in any operating classes. In case of no non-preferred channels the attribute length field shall be set to zero and the Operating Class, Channel List, Preference and Reason Code fields shall not be included. This indicates to the MBO AP that the MBO STA has no non-preferred channels access all supported operating classes. Signed-off-by: Jouni Malinen --- wpa_supplicant/mbo.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/wpa_supplicant/mbo.c b/wpa_supplicant/mbo.c index d2f145114..43722a976 100644 --- a/wpa_supplicant/mbo.c +++ b/wpa_supplicant/mbo.c @@ -98,6 +98,13 @@ static void wpas_mbo_non_pref_chan_attr_body(struct wpa_supplicant *wpa_s, } +static void wpas_mbo_non_pref_chan_attr_hdr(struct wpabuf *mbo, size_t size) +{ + wpabuf_put_u8(mbo, MBO_ATTR_ID_NON_PREF_CHAN_REPORT); + wpabuf_put_u8(mbo, size); /* Length */ +} + + static void wpas_mbo_non_pref_chan_attr(struct wpa_supplicant *wpa_s, struct wpabuf *mbo, u8 start, u8 end) { @@ -106,9 +113,7 @@ static void wpas_mbo_non_pref_chan_attr(struct wpa_supplicant *wpa_s, if (size + 2 > wpabuf_tailroom(mbo)) return; - wpabuf_put_u8(mbo, MBO_ATTR_ID_NON_PREF_CHAN_REPORT); - wpabuf_put_u8(mbo, size); /* Length */ - + wpas_mbo_non_pref_chan_attr_hdr(mbo, size); wpas_mbo_non_pref_chan_attr_body(wpa_s, mbo, start, end); } @@ -145,6 +150,8 @@ static void wpas_mbo_non_pref_chan_attrs(struct wpa_supplicant *wpa_s, if (!wpa_s->non_pref_chan || !wpa_s->non_pref_chan_num) { if (subelement) wpas_mbo_non_pref_chan_subelem_hdr(mbo, 4); + else + wpas_mbo_non_pref_chan_attr_hdr(mbo, 0); return; } start_pref = &wpa_s->non_pref_chan[0];