#include "utils/common.h"
#include "common/ieee802_11_defs.h"
+#include "common/gas.h"
#include "config.h"
#include "wpa_supplicant_i.h"
#include "driver_i.h"
wpabuf_put_u8(mbo, wpa_s->non_pref_chan[start].preference);
wpabuf_put_u8(mbo, wpa_s->non_pref_chan[start].reason);
- wpabuf_put_u8(mbo, wpa_s->non_pref_chan[start].reason_detail);
}
static void wpas_mbo_non_pref_chan_attr(struct wpa_supplicant *wpa_s,
struct wpabuf *mbo, u8 start, u8 end)
{
- size_t size = end - start + 4;
+ size_t size = end - start + 3;
if (size + 2 > wpabuf_tailroom(mbo))
return;
struct wpabuf *mbo, u8 start,
u8 end)
{
- size_t size = end - start + 8;
+ size_t size = end - start + 7;
if (size + 2 > wpabuf_tailroom(mbo))
return;
if (!non_pref ||
non_pref->oper_class != start_pref->oper_class ||
non_pref->reason != start_pref->reason ||
- non_pref->reason_detail != start_pref->reason_detail ||
non_pref->preference != start_pref->preference) {
if (subelement)
wpas_mbo_non_pref_chan_subelement(wpa_s, mbo,
*
* In MBO IE non-preferred channel subelement we can put many channels in an
* attribute if they are in the same operating class and have the same
- * preference, reason, and reason detail. To make it easy for the functions that
- * build the IE attributes and WNM Request subelements, save the channels sorted
- * by their oper_class, reason, and reason_detail.
+ * preference and reason. To make it easy for the functions that build
+ * the IE attributes and WNM Request subelements, save the channels sorted
+ * by their oper_class and reason.
*/
static int wpa_non_pref_chan_cmp(const void *_a, const void *_b)
{
return a->oper_class - b->oper_class;
if (a->reason != b->reason)
return a->reason - b->reason;
- if (a->reason_detail != b->reason_detail)
- return a->reason_detail - b->reason_detail;
return a->preference - b->preference;
}
unsigned int _chan;
unsigned int _preference;
unsigned int _reason;
- unsigned int _reason_detail;
if (num == size) {
size = size ? size * 2 : 1;
chan = &chans[num];
- ret = sscanf(token, "%u:%u:%u:%u:%u", &_oper_class,
- &_chan, &_preference, &_reason,
- &_reason_detail);
- if ((ret != 4 && ret != 5) ||
+ ret = sscanf(token, "%u:%u:%u:%u", &_oper_class,
+ &_chan, &_preference, &_reason);
+ if (ret != 4 ||
_oper_class > 255 || _chan > 255 ||
- _preference > 255 || _reason > 65535 ||
- (ret == 5 && _reason_detail > 255)) {
+ _preference > 255 || _reason > 65535 ) {
wpa_printf(MSG_ERROR, "Invalid non-pref chan input %s",
token);
goto fail;
chan->chan = _chan;
chan->preference = _preference;
chan->reason = _reason;
- chan->reason_detail = ret == 4 ? 0 : _reason_detail;
if (wpas_mbo_validate_non_pref_chan(chan->oper_class,
chan->chan, chan->reason)) {
wpas_mbo_send_wnm_notification(wpa_s, cell_capa, 7);
wpa_supplicant_set_default_scan_ies(wpa_s);
}
+
+
+struct wpabuf * mbo_build_anqp_buf(struct wpa_supplicant *wpa_s,
+ struct wpa_bss *bss)
+{
+ struct wpabuf *anqp_buf;
+ u8 *len_pos;
+
+ if (!wpa_bss_get_vendor_ie(bss, MBO_IE_VENDOR_TYPE)) {
+ wpa_printf(MSG_INFO, "MBO: " MACSTR
+ " does not support MBO - cannot request MBO ANQP elements from it",
+ MAC2STR(bss->bssid));
+ return NULL;
+ }
+
+ anqp_buf = wpabuf_alloc(10);
+ if (!anqp_buf)
+ return NULL;
+
+ len_pos = gas_anqp_add_element(anqp_buf, ANQP_VENDOR_SPECIFIC);
+ wpabuf_put_be24(anqp_buf, OUI_WFA);
+ wpabuf_put_u8(anqp_buf, MBO_ANQP_OUI_TYPE);
+
+ wpabuf_put_u8(anqp_buf, MBO_ANQP_SUBTYPE_CELL_CONN_PREF);
+ gas_anqp_set_element_len(anqp_buf, len_pos);
+
+ return anqp_buf;
+}