X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=src%2Fcommon%2Fieee802_11_common.c;h=34fa968cc3929cdf7d68e1116eabfe8db115a639;hb=92c6e2e3a92906083d11471ea1b2965758068d8d;hp=9af2606913f3489741f6d0ec87225e0076dd0d58;hpb=facf2c728a59af817aad9fe70d23d8b2519d8a94;p=mech_eap.git diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c index 9af2606..34fa968 100644 --- a/src/common/ieee802_11_common.c +++ b/src/common/ieee802_11_common.c @@ -1205,3 +1205,27 @@ const u8 * get_ie(const u8 *ies, size_t len, u8 eid) return NULL; } + + +size_t mbo_add_ie(u8 *buf, size_t len, const u8 *attr, size_t attr_len) +{ + /* + * MBO IE requires 6 bytes without the attributes: EID (1), length (1), + * OUI (3), OUI type (1). + */ + if (len < 6 + attr_len) { + wpa_printf(MSG_DEBUG, + "MBO: Not enough room in buffer for MBO IE: buf len = %zu, attr_len = %zu", + len, attr_len); + return 0; + } + + *buf++ = WLAN_EID_VENDOR_SPECIFIC; + *buf++ = attr_len + 4; + WPA_PUT_BE24(buf, OUI_WFA); + buf += 3; + *buf++ = MBO_OUI_TYPE; + os_memcpy(buf, attr, attr_len); + + return 6 + attr_len; +}