From: Ankita Bajaj Date: Fri, 5 Apr 2019 09:07:40 +0000 (+0530) Subject: MBO: Always include Non-preferred Channel Report attribute in AssocReq X-Git-Tag: hostap_2_8~145 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74f8e768f222cb585a7d0a6bfbabd48967df3008;p=thirdparty%2Fhostap.git 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 --- 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];